1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Invoke the registered Action when a stateful item is right clicked

This commit is contained in:
Jonas Brandstötter 2024-05-04 16:01:31 +02:00
parent 21917218ce
commit c62952ea3a
No known key found for this signature in database
GPG Key ID: DF758C8A6271E098

View File

@ -4,6 +4,8 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osuTK.Input;
using osuTK; using osuTK;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -19,8 +21,16 @@ namespace osu.Game.Graphics.UserInterface
protected override TextContainer CreateTextContainer() => new ToggleTextContainer(Item); protected override TextContainer CreateTextContainer() => new ToggleTextContainer(Item);
protected override bool OnMouseDown(MouseDownEvent e)
{ {
if (!IsActionable)
return true;
if (e.Button != MouseButton.Right)
return true;
Item.Action.Value?.Invoke();
return true;
} }
private partial class ToggleTextContainer : TextContainer private partial class ToggleTextContainer : TextContainer