1
0
mirror of https://github.com/ppy/osu.git synced 2024-10-01 23:37:30 +08:00
osu-lazer/osu.Game/Overlays/Changelog/Header/LineBadge.cs
HoutarouOreki 523d47e815 Streams1
2018-07-18 01:35:06 +02:00

43 lines
1.3 KiB
C#

// 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
{
public float TransitionDuration = 100;
public float UncollapsedHeight;
public float CollapsedHeight;
protected bool isCollapsed;
public bool IsCollapsed
{
get { return isCollapsed; }
set
{
isCollapsed = value;
this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight, TransitionDuration);
}
}
public LineBadge(bool startCollapsed = true, float collapsedHeight = 1, float uncollapsedHeight = 10)
{
Anchor = Anchor.BottomCentre;
Origin = Anchor.Centre;
CollapsedHeight = collapsedHeight;
UncollapsedHeight = uncollapsedHeight;
Height = startCollapsed ? CollapsedHeight : UncollapsedHeight;
// this margin prevents jumps when changing text's font weight
Margin = new MarginPadding()
{
Left = 10,
Right = 10,
};
}
}
}