Adjust BreadcrumbControl to better match the designs.

This commit is contained in:
DrabWeb 2018-05-10 20:30:03 -03:00
parent 0afe33d32f
commit ecb8de29a2

View File

@ -14,14 +14,18 @@ namespace osu.Game.Graphics.UserInterface
public class BreadcrumbControl<T> : OsuTabControl<T> public class BreadcrumbControl<T> : OsuTabControl<T>
{ {
private const float padding = 10; private const float padding = 10;
private const float item_chevron_size = 10;
protected override TabItem<T> CreateTabItem(T value) => new BreadcrumbTabItem(value); protected override TabItem<T> CreateTabItem(T value) => new BreadcrumbTabItem(value)
{
AccentColour = AccentColour,
};
protected override float StripWidth() => base.StripWidth() - (padding + 8); protected override float StripWidth() => base.StripWidth() - (padding + item_chevron_size);
public BreadcrumbControl() public BreadcrumbControl()
{ {
Height = 26; Height = 32;
TabContainer.Spacing = new Vector2(padding, 0f); TabContainer.Spacing = new Vector2(padding, 0f);
Current.ValueChanged += tab => Current.ValueChanged += tab =>
{ {
@ -47,6 +51,7 @@ namespace osu.Game.Graphics.UserInterface
public override bool HandleKeyboardInput => State == Visibility.Visible; public override bool HandleKeyboardInput => State == Visibility.Visible;
public override bool HandleMouseInput => State == Visibility.Visible; public override bool HandleMouseInput => State == Visibility.Visible;
public override bool IsRemovable => true;
private Visibility state; private Visibility state;
@ -77,13 +82,14 @@ namespace osu.Game.Graphics.UserInterface
public BreadcrumbTabItem(T value) : base(value) public BreadcrumbTabItem(T value) : base(value)
{ {
Text.TextSize = 16; Text.TextSize = 18;
Padding = new MarginPadding { Right = padding + 8 }; //padding + chevron width Text.Margin = new MarginPadding { Vertical = 8 };
Padding = new MarginPadding { Right = padding + item_chevron_size };
Add(Chevron = new SpriteIcon Add(Chevron = new SpriteIcon
{ {
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Size = new Vector2(12), Size = new Vector2(item_chevron_size),
Icon = FontAwesome.fa_chevron_right, Icon = FontAwesome.fa_chevron_right,
Margin = new MarginPadding { Left = padding }, Margin = new MarginPadding { Left = padding },
Alpha = 0f, Alpha = 0f,