1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00
This commit is contained in:
DrabWeb 2017-05-26 16:29:20 -03:00
parent 352d3d247b
commit 4c127a6130

View File

@ -1,17 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface
{
public class BreadcrumbControl<T> : OsuTabControl<T>
{
public static readonly float padding = 10;
public const float padding = 10;
protected override TabItem<T> CreateTabItem(T value) => new BreadcrumbTabItem(value);
@ -23,8 +21,6 @@ namespace osu.Game.Graphics.UserInterface
{
foreach (TabItem<T> t in TabContainer.Children)
{
if (!(t is BreadcrumbTabItem)) return;
var tIndex = TabContainer.IndexOf(t);
var tabIndex = TabContainer.IndexOf(TabMap[tab]);
var hide = tIndex < tabIndex;
@ -32,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface
t.FadeTo(hide ? 0f : 1f, 500, EasingTypes.OutQuint);
t.ScaleTo(new Vector2(hide ? 0.8f : 1f, 1f), 500, EasingTypes.OutQuint);
(t as BreadcrumbTabItem).Chevron.FadeTo(hideChevron ? 0f : 1f, 500, EasingTypes.OutQuint);
((BreadcrumbTabItem)t).Chevron.FadeTo(hideChevron ? 0f : 1f, 500, EasingTypes.OutQuint);
}
};
}
@ -42,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface
public readonly TextAwesome Chevron;
//don't allow clicking between transitions and don't make the chevron clickable
protected override bool InternalContains(Vector2 screenSpacePos) => Alpha < 1f ? false : Text.Contains(screenSpacePos);
protected override bool InternalContains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos);
public BreadcrumbTabItem(T value) : base(value)
{