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-18 07:35:06 +08:00
|
|
|
|
public float TransitionDuration = 100;
|
|
|
|
|
public float UncollapsedHeight;
|
|
|
|
|
public float CollapsedHeight;
|
2018-07-18 00:32:11 +08:00
|
|
|
|
|
|
|
|
|
protected bool isCollapsed;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
public bool IsCollapsed
|
|
|
|
|
{
|
|
|
|
|
get { return isCollapsed; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
isCollapsed = value;
|
2018-07-18 07:35:06 +08:00
|
|
|
|
this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight, TransitionDuration);
|
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-17 21:01:53 +08:00
|
|
|
|
Margin = new MarginPadding()
|
|
|
|
|
{
|
|
|
|
|
Left = 10,
|
|
|
|
|
Right = 10,
|
|
|
|
|
};
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|