1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 03:02:56 +08:00

Method to property

This commit is contained in:
Dean Herbert 2020-01-02 14:19:31 +09:00
parent 19e7867aba
commit 546f64f951
2 changed files with 6 additions and 5 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Graphics.UserInterface
AccentColour = AccentColour, AccentColour = AccentColour,
}; };
protected override float StripWidth() => base.StripWidth() - (padding + ItemChevronSize); protected override float StripWidth => base.StripWidth - (padding + ItemChevronSize);
public BreadcrumbControl() public BreadcrumbControl()
{ {

View File

@ -28,8 +28,9 @@ namespace osu.Game.Graphics.UserInterface
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem(value); protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem(value);
protected virtual float StripWidth() => TabContainer.Children.Sum(c => c.IsPresent ? c.DrawWidth + TabContainer.Spacing.X : 0) - TabContainer.Spacing.X; protected virtual float StripWidth => TabContainer.Children.Sum(c => c.IsPresent ? c.DrawWidth + TabContainer.Spacing.X : 0) - TabContainer.Spacing.X;
protected virtual float StripHeight() => 1;
protected virtual float StripHeight => 1;
/// <summary> /// <summary>
/// Whether entries should be automatically populated if <typeparamref name="T"/> is an <see cref="Enum"/> type. /// Whether entries should be automatically populated if <typeparamref name="T"/> is an <see cref="Enum"/> type.
@ -46,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Height = StripHeight(), Height = StripHeight,
Colour = Color4.White.Opacity(0), Colour = Color4.White.Opacity(0),
}); });
@ -99,7 +100,7 @@ namespace osu.Game.Graphics.UserInterface
// dont bother calculating if the strip is invisible // dont bother calculating if the strip is invisible
if (strip.Colour.MaxAlpha > 0) if (strip.Colour.MaxAlpha > 0)
strip.Width = Interpolation.ValueAt(Math.Clamp(Clock.ElapsedFrameTime, 0, 1000), strip.Width, StripWidth(), 0, 500, Easing.OutQuint); strip.Width = Interpolation.ValueAt(Math.Clamp(Clock.ElapsedFrameTime, 0, 1000), strip.Width, StripWidth, 0, 500, Easing.OutQuint);
} }
public class OsuTabItem : TabItem<T>, IHasAccentColour public class OsuTabItem : TabItem<T>, IHasAccentColour