diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index c98280bc75..e2438cc4cd 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -16,14 +16,12 @@ namespace osu.Game.Graphics.UserInterface { private const float padding = 10; - protected virtual float ItemChevronSize => 10; - - protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value, ItemChevronSize) + protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value) { AccentColour = AccentColour, }; - protected override float StripWidth => base.StripWidth - (padding + ItemChevronSize); + protected override float StripWidth => base.StripWidth - TabContainer.FirstOrDefault()?.Padding.Right ?? 0; public BreadcrumbControl() { @@ -44,6 +42,8 @@ namespace osu.Game.Graphics.UserInterface protected class BreadcrumbTabItem : OsuTabItem, IStateful { + protected virtual float ChevronSize => 10; + public event Action StateChanged; public readonly SpriteIcon Chevron; @@ -86,17 +86,17 @@ namespace osu.Game.Graphics.UserInterface public override void Show() => State = Visibility.Visible; - public BreadcrumbTabItem(T value, float itemChevronSize) + public BreadcrumbTabItem(T value) : base(value) { Text.Font = Text.Font.With(size: 18); Text.Margin = new MarginPadding { Vertical = 8 }; - Padding = new MarginPadding { Right = padding + itemChevronSize }; + Padding = new MarginPadding { Right = padding + ChevronSize }; Add(Chevron = new SpriteIcon { Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, - Size = new Vector2(itemChevronSize), + Size = new Vector2(ChevronSize), Icon = FontAwesome.Solid.ChevronRight, Margin = new MarginPadding { Left = padding }, Alpha = 0f, diff --git a/osu.Game/Overlays/OverlayHeaderBreadcrumbControl.cs b/osu.Game/Overlays/OverlayHeaderBreadcrumbControl.cs index eee43ec229..34941c5647 100644 --- a/osu.Game/Overlays/OverlayHeaderBreadcrumbControl.cs +++ b/osu.Game/Overlays/OverlayHeaderBreadcrumbControl.cs @@ -14,14 +14,14 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.X; } - protected override float ItemChevronSize => 8; - - protected override TabItem CreateTabItem(string value) => new ControlTabItem(value, ItemChevronSize); + protected override TabItem CreateTabItem(string value) => new ControlTabItem(value); private class ControlTabItem : BreadcrumbTabItem { - public ControlTabItem(string value, float itemChevronSize) - : base(value, itemChevronSize) + protected override float ChevronSize => 8; + + public ControlTabItem(string value) + : base(value) { Text.Font = Text.Font.With(size: 14); Chevron.Y = 3;