Also only expose `Expanded` state of `BeatmapCard` as read-only

This commit is contained in:
Dean Herbert 2021-12-15 16:19:47 +09:00
parent 41e6c24dad
commit ef4ab74565
2 changed files with 5 additions and 6 deletions

View File

@ -33,7 +33,7 @@ public class BeatmapCard : OsuClickableContainer
public const float TRANSITION_DURATION = 400;
public const float CORNER_RADIUS = 10;
public Bindable<bool> Expanded { get; } = new BindableBool();
public IBindable<bool> Expanded { get; }
private const float width = 408;
private const float height = 100;
@ -64,9 +64,11 @@ public class BeatmapCard : OsuClickableContainer
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public BeatmapCard(APIBeatmapSet beatmapSet)
public BeatmapCard(APIBeatmapSet beatmapSet, bool allowExpansion = true)
: base(HoverSampleSet.Submit)
{
Expanded = new BindableBool { Disabled = !allowExpansion };
this.beatmapSet = beatmapSet;
favouriteState = new Bindable<BeatmapSetFavouriteState>(new BeatmapSetFavouriteState(beatmapSet.HasFavourited, beatmapSet.FavouriteCount));
downloadTracker = new BeatmapDownloadTracker(beatmapSet);

View File

@ -228,10 +228,7 @@ private void showBeatmapPanel(SpectatorState state)
onlineBeatmapRequest.Success += beatmapSet => Schedule(() =>
{
this.beatmapSet = beatmapSet;
beatmapPanelContainer.Child = new BeatmapCard(this.beatmapSet)
{
Expanded = { Disabled = true }
};
beatmapPanelContainer.Child = new BeatmapCard(this.beatmapSet, allowExpansion: false);
checkForAutomaticDownload();
});