2018-07-17 05:50:22 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Changelog.Header
|
|
|
|
|
{
|
|
|
|
|
public class LineBadge : Circle
|
|
|
|
|
{
|
2018-07-19 01:32:15 +08:00
|
|
|
|
public float TransitionDuration = 400;
|
2018-07-18 07:35:06 +08:00
|
|
|
|
public float UncollapsedHeight;
|
|
|
|
|
public float CollapsedHeight;
|
2018-07-18 00:32:11 +08:00
|
|
|
|
|
2018-07-19 01:32:15 +08:00
|
|
|
|
private bool isCollapsed;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
public bool IsCollapsed
|
|
|
|
|
{
|
|
|
|
|
get { return isCollapsed; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
isCollapsed = value;
|
2018-07-19 01:32:15 +08:00
|
|
|
|
this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight,
|
|
|
|
|
value ? TransitionDuration / 2f : TransitionDuration,
|
|
|
|
|
value ? Easing.Out : Easing.OutElastic);
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-18 07:35:06 +08:00
|
|
|
|
public LineBadge(bool startCollapsed = true, float collapsedHeight = 1, float uncollapsedHeight = 10)
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre;
|
|
|
|
|
Origin = Anchor.Centre;
|
2018-07-18 07:35:06 +08:00
|
|
|
|
CollapsedHeight = collapsedHeight;
|
|
|
|
|
UncollapsedHeight = uncollapsedHeight;
|
|
|
|
|
Height = startCollapsed ? CollapsedHeight : UncollapsedHeight;
|
2018-07-18 00:32:11 +08:00
|
|
|
|
|
|
|
|
|
// this margin prevents jumps when changing text's font weight
|
2018-07-19 01:32:15 +08:00
|
|
|
|
Margin = new MarginPadding
|
2018-07-17 21:01:53 +08:00
|
|
|
|
{
|
|
|
|
|
Left = 10,
|
|
|
|
|
Right = 10,
|
|
|
|
|
};
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|