Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable scale animation when holding editor "test" button #31854

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
Expand All @@ -14,6 +15,9 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
{
public partial class TestGameplayButton : OsuButton
{
[Resolved]
private OsuColour colours { get; set; } = null!;

protected override SpriteText CreateText() => new OsuSpriteText
{
Depth = -1,
Expand All @@ -24,7 +28,7 @@ public partial class TestGameplayButton : OsuButton
};

[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider)
{
BackgroundColour = colours.Orange1;
SpriteText.Colour = colourProvider.Background6;
Expand All @@ -33,5 +37,18 @@ private void load(OsuColour colours, OverlayColourProvider colourProvider)

Text = EditorStrings.TestBeatmap;
}

protected override bool OnMouseDown(MouseDownEvent e)
{
Background.FadeColour(colours.Orange0, 500, Easing.OutQuint);
// don't call base in order to block scale animation
return false;
}

protected override void OnMouseUp(MouseUpEvent e)
{
Background.FadeColour(colours.Orange1, 300, Easing.OutQuint);
// don't call base in order to block scale animation
}
}
}
Loading