From ab7178267459a27b5a3a9896013cd09fe250dac9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 25 Apr 2021 07:43:56 +0300 Subject: [PATCH] Use colour fade transform for selection box controls To become harminous with the fade transforms of the rotation control --- .../Edit/Compose/Components/SelectionBoxButton.cs | 2 +- .../Edit/Compose/Components/SelectionBoxControl.cs | 10 ++++++++-- .../Compose/Components/SelectionBoxRotationHandle.cs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs index 917e5189b2..fbbebe3288 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit.Compose.Components protected override void UpdateHoverState() { base.UpdateHoverState(); - icon.Colour = !HandlingMouse && IsHovered ? Color4.White : Color4.Black; + icon.FadeColour(!HandlingMouse && IsHovered ? Color4.White : Color4.Black, TRANSFORM_DURATION, Easing.OutQuint); } public string TooltipText { get; } diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs index 081848f372..374af20742 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs @@ -17,6 +17,8 @@ namespace osu.Game.Screens.Edit.Compose.Components /// public abstract class SelectionBoxControl : CompositeDrawable { + public const double TRANSFORM_DURATION = 100; + public event Action OperationStarted; public event Action OperationEnded; @@ -90,8 +92,12 @@ namespace osu.Game.Screens.Edit.Compose.Components protected virtual void UpdateHoverState() { - circle.Colour = HandlingMouse ? Colours.GrayF : (IsHovered ? Colours.Red : Colours.YellowDark); - this.ScaleTo(HandlingMouse || IsHovered ? 1.5f : 1, 100, Easing.OutQuint); + if (HandlingMouse) + circle.FadeColour(Colours.GrayF, TRANSFORM_DURATION, Easing.OutQuint); + else + circle.FadeColour(IsHovered ? Colours.Red : Colours.YellowDark, TRANSFORM_DURATION, Easing.OutQuint); + + this.ScaleTo(HandlingMouse || IsHovered ? 1.5f : 1, TRANSFORM_DURATION, Easing.OutQuint); } protected void OnOperationStarted() diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs index c4a4fafdc2..6303caf9ed 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs @@ -35,8 +35,8 @@ namespace osu.Game.Screens.Edit.Compose.Components protected override void UpdateHoverState() { - icon.Colour = !HandlingMouse && IsHovered ? Color4.White : Color4.Black; base.UpdateHoverState(); + icon.FadeColour(!HandlingMouse && IsHovered ? Color4.White : Color4.Black, TRANSFORM_DURATION, Easing.OutQuint); } } }