1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 14:10:48 +08:00

Adjust mouse down animation in a better way (and apply to small tag buttons too)

This commit is contained in:
Dean Herbert
2025-04-03 19:19:06 +09:00
Unverified
parent 375beae8a9
commit 2a3241fd48
2 changed files with 7 additions and 10 deletions
@@ -25,6 +25,8 @@ namespace osu.Game.Graphics.UserInterface
private Color4 hoverColour = Color4.White.Opacity(0.1f);
protected float ScaleOnMouseDown { get; init; } = 0.75f;
/// <summary>
/// The background colour of the <see cref="OsuAnimatedButton"/> while it is hovered.
/// </summary>
@@ -119,7 +121,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnMouseDown(MouseDownEvent e)
{
Content.ScaleTo(0.75f, 2000, Easing.OutQuint);
Content.ScaleTo(ScaleOnMouseDown, 2000, Easing.OutQuint);
return base.OnMouseDown(e);
}
+4 -9
View File
@@ -319,6 +319,8 @@ namespace osu.Game.Screens.Ranking
voted.BindTo(userTag.Voted);
AutoSizeAxes = Axes.Both;
ScaleOnMouseDown = 0.95f;
}
[BackgroundDependencyLoader]
@@ -654,6 +656,8 @@ namespace osu.Game.Screens.Ranking
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
ScaleOnMouseDown = 0.95f;
}
[Resolved]
@@ -736,15 +740,6 @@ namespace osu.Game.Screens.Ranking
}, true);
FinishTransforms(true);
}
protected override bool OnMouseDown(MouseDownEvent e)
{
bool result = base.OnMouseDown(e);
// slightly dodgy way of overriding the amount of scale-on-click (the default is way too much in this case)
ClearTransforms(targetMember: nameof(Scale));
Content.ScaleTo(0.95f, 2000, Easing.OutQuint);
return result;
}
}
}
}