1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 01:37:31 +08:00

Move chevron size implementation

This commit is contained in:
Dean Herbert 2020-01-02 14:26:40 +09:00
parent 43903b2fea
commit d1d19c2cd9
2 changed files with 12 additions and 12 deletions

View File

@ -16,14 +16,12 @@ namespace osu.Game.Graphics.UserInterface
{
private const float padding = 10;
protected virtual float ItemChevronSize => 10;
protected override TabItem<T> CreateTabItem(T value) => new BreadcrumbTabItem(value, ItemChevronSize)
protected override TabItem<T> 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<Visibility>
{
protected virtual float ChevronSize => 10;
public event Action<Visibility> 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,

View File

@ -14,14 +14,14 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X;
}
protected override float ItemChevronSize => 8;
protected override TabItem<string> CreateTabItem(string value) => new ControlTabItem(value, ItemChevronSize);
protected override TabItem<string> 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;