overall fixes

This commit is contained in:
EVAST9919 2017-05-23 16:01:00 +03:00
parent 2ca0794b37
commit 178f8127b8
2 changed files with 15 additions and 21 deletions

View File

@ -26,9 +26,9 @@ public abstract class SettingsDropdownContainer : Container
private FillFlowContainer content;
private SimpleButton button;
private bool buttonIsPressed;
private bool buttonIsActive;
private Color4 buttonPressedColour;
private Color4 buttonActiveColour;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
@ -82,7 +82,7 @@ private void load(OsuColour colours)
Position = new Vector2(-15,0),
Icon = FontAwesome.fa_bars,
Scale = new Vector2(0.75f),
Colour = buttonPressedColour = colours.Yellow,
Colour = buttonActiveColour = colours.Yellow,
Action = triggerContentVisibility,
},
}
@ -92,9 +92,9 @@ private void load(OsuColour colours)
Name = @"Content",
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
AutoSizeDuration = transition_duration,
AutoSizeEasing = EasingTypes.OutQuint,
AutoSizeAxes = Axes.Y,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Padding = new MarginPadding(15),
@ -112,20 +112,15 @@ private void load(OsuColour colours)
private void triggerContentVisibility()
{
if (buttonIsPressed)
{
content.ClearTransforms();
content.AutoSizeAxes = Axes.Y;
}
else
{
content.AutoSizeAxes = Axes.None;
content.ClearTransforms();
content.AutoSizeAxes = buttonIsActive ? Axes.Y : Axes.None;
if (!buttonIsActive)
content.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint);
}
button.FadeColour(buttonIsPressed ? buttonPressedColour : Color4.White, 200, EasingTypes.OutQuint);
button.FadeColour(buttonIsActive ? buttonActiveColour : Color4.White, 200, EasingTypes.OutQuint);
buttonIsPressed = !buttonIsPressed;
buttonIsActive = !buttonIsActive;
}
}
}

View File

@ -21,7 +21,10 @@ public bool IsAvaliable
set
{
isAvaliable = value;
if (!isAvaliable) Hide();
if (isAvaliable)
Show();
else
Hide();
}
get
{
@ -62,11 +65,7 @@ private void toogleVisibility()
{
if (isAvaliable)
{
if (isVisible)
FadeIn(fade_duration);
else
FadeOut(fade_duration);
FadeTo(isVisible ? 1 : 0, fade_duration);
isVisible = !isVisible;
}
}