Remove DrawableCarouselItem.Update updating of height

Marginal from a performance aspect, but reads better.
This commit is contained in:
Dean Herbert 2022-01-30 12:34:08 +09:00
parent e9f3e7f5cb
commit a06287e76a
2 changed files with 9 additions and 12 deletions

View File

@ -36,9 +36,9 @@ namespace osu.Game.Screens.Select.Carousel
/// <summary>
/// The height of a carousel beatmap, including vertical spacing.
/// </summary>
public const float HEIGHT = height + CAROUSEL_BEATMAP_SPACING;
public const float HEIGHT = header_height + CAROUSEL_BEATMAP_SPACING;
private const float height = MAX_HEIGHT * 0.6f;
private const float header_height = MAX_HEIGHT * 0.6f;
private readonly BeatmapInfo beatmapInfo;
@ -67,6 +67,7 @@ namespace osu.Game.Screens.Select.Carousel
private CancellationTokenSource starDifficultyCancellationSource;
public DrawableCarouselBeatmap(CarouselBeatmap panel)
: base(header_height)
{
beatmapInfo = panel.BeatmapInfo;
Item = panel;
@ -75,8 +76,6 @@ namespace osu.Game.Screens.Select.Carousel
[BackgroundDependencyLoader(true)]
private void load(BeatmapManager manager, SongSelect songSelect)
{
Header.Height = height;
if (songSelect != null)
{
startRequested = b => songSelect.FinaliseSelection(b);

View File

@ -60,7 +60,7 @@ namespace osu.Game.Screens.Select.Carousel
}
}
protected DrawableCarouselItem()
protected DrawableCarouselItem(float headerHeight = MAX_HEIGHT)
{
RelativeSizeAxes = Axes.X;
@ -73,10 +73,14 @@ namespace osu.Game.Screens.Select.Carousel
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
Header = new CarouselHeader(),
Header = new CarouselHeader
{
Height = headerHeight,
},
Content = new Container
{
RelativeSizeAxes = Axes.Both,
Y = headerHeight,
}
}
},
@ -92,12 +96,6 @@ namespace osu.Game.Screens.Select.Carousel
UpdateItem();
}
protected override void Update()
{
base.Update();
Content.Y = Header.Height;
}
protected virtual void UpdateItem()
{
if (item == null)