mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 01:37:46 +08:00
Move chevron size implementation
This commit is contained in:
parent
43903b2fea
commit
d1d19c2cd9
@ -16,14 +16,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
private const float padding = 10;
|
private const float padding = 10;
|
||||||
|
|
||||||
protected virtual float ItemChevronSize => 10;
|
protected override TabItem<T> CreateTabItem(T value) => new BreadcrumbTabItem(value)
|
||||||
|
|
||||||
protected override TabItem<T> CreateTabItem(T value) => new BreadcrumbTabItem(value, ItemChevronSize)
|
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override float StripWidth => base.StripWidth - (padding + ItemChevronSize);
|
protected override float StripWidth => base.StripWidth - TabContainer.FirstOrDefault()?.Padding.Right ?? 0;
|
||||||
|
|
||||||
public BreadcrumbControl()
|
public BreadcrumbControl()
|
||||||
{
|
{
|
||||||
@ -44,6 +42,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
|
protected class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
|
||||||
{
|
{
|
||||||
|
protected virtual float ChevronSize => 10;
|
||||||
|
|
||||||
public event Action<Visibility> StateChanged;
|
public event Action<Visibility> StateChanged;
|
||||||
|
|
||||||
public readonly SpriteIcon Chevron;
|
public readonly SpriteIcon Chevron;
|
||||||
@ -86,17 +86,17 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
public override void Show() => State = Visibility.Visible;
|
public override void Show() => State = Visibility.Visible;
|
||||||
|
|
||||||
public BreadcrumbTabItem(T value, float itemChevronSize)
|
public BreadcrumbTabItem(T value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
Text.Font = Text.Font.With(size: 18);
|
Text.Font = Text.Font.With(size: 18);
|
||||||
Text.Margin = new MarginPadding { Vertical = 8 };
|
Text.Margin = new MarginPadding { Vertical = 8 };
|
||||||
Padding = new MarginPadding { Right = padding + itemChevronSize };
|
Padding = new MarginPadding { Right = padding + ChevronSize };
|
||||||
Add(Chevron = new SpriteIcon
|
Add(Chevron = new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Size = new Vector2(itemChevronSize),
|
Size = new Vector2(ChevronSize),
|
||||||
Icon = FontAwesome.Solid.ChevronRight,
|
Icon = FontAwesome.Solid.ChevronRight,
|
||||||
Margin = new MarginPadding { Left = padding },
|
Margin = new MarginPadding { Left = padding },
|
||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
|
@ -14,14 +14,14 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override float ItemChevronSize => 8;
|
protected override TabItem<string> CreateTabItem(string value) => new ControlTabItem(value);
|
||||||
|
|
||||||
protected override TabItem<string> CreateTabItem(string value) => new ControlTabItem(value, ItemChevronSize);
|
|
||||||
|
|
||||||
private class ControlTabItem : BreadcrumbTabItem
|
private class ControlTabItem : BreadcrumbTabItem
|
||||||
{
|
{
|
||||||
public ControlTabItem(string value, float itemChevronSize)
|
protected override float ChevronSize => 8;
|
||||||
: base(value, itemChevronSize)
|
|
||||||
|
public ControlTabItem(string value)
|
||||||
|
: base(value)
|
||||||
{
|
{
|
||||||
Text.Font = Text.Font.With(size: 14);
|
Text.Font = Text.Font.With(size: 14);
|
||||||
Chevron.Y = 3;
|
Chevron.Y = 3;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user