Change method structure for hover/unhover state setting (shouldn't be called "Fade")

This commit is contained in:
Dean Herbert 2020-07-30 13:49:04 +09:00
parent ed699ae913
commit e5991d6e14
2 changed files with 8 additions and 9 deletions

View File

@ -98,16 +98,16 @@ private void load(OverlayColourProvider colourProvider)
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
leftIcon.FadeHoverColour();
rightIcon.FadeHoverColour();
leftIcon.SetHoveredState(true);
rightIcon.SetHoveredState(true);
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
leftIcon.FadeIdleColour();
rightIcon.FadeIdleColour();
leftIcon.SetHoveredState(false);
rightIcon.SetHoveredState(false);
}
public class ChevronIcon : SpriteIcon
@ -127,9 +127,8 @@ private void load()
Colour = colourProvider.Foreground1;
}
public void FadeHoverColour() => this.FadeColour(colourProvider.Light1, 200, Easing.OutQuint);
public void FadeIdleColour() => this.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint);
public void SetHoveredState(bool hovered) =>
this.FadeColour(hovered ? colourProvider.Light1 : colourProvider.Foreground1, 200, Easing.OutQuint);
}
}
}

View File

@ -96,7 +96,7 @@ protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
background.FadeColour(colourProvider.Background1, 200, Easing.OutQuint);
icon.FadeHoverColour();
icon.SetHoveredState(true);
return true;
}
@ -104,7 +104,7 @@ protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint);
icon.FadeIdleColour();
icon.SetHoveredState(false);
}
}
}