Action UI fixes (#27468)
This commit is contained in:
@@ -152,16 +152,8 @@ public sealed class ActionButton : Control, IEntityControl
|
||||
|
||||
OnThemeUpdated();
|
||||
|
||||
OnKeyBindDown += args =>
|
||||
{
|
||||
Depress(args, true);
|
||||
OnPressed(args);
|
||||
};
|
||||
OnKeyBindUp += args =>
|
||||
{
|
||||
Depress(args, false);
|
||||
OnUnpressed(args);
|
||||
};
|
||||
OnKeyBindDown += OnPressed;
|
||||
OnKeyBindUp += OnUnpressed;
|
||||
|
||||
TooltipSupplier = SupplyTooltip;
|
||||
}
|
||||
@@ -175,11 +167,23 @@ public sealed class ActionButton : Control, IEntityControl
|
||||
|
||||
private void OnPressed(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
if (args.Function != EngineKeyFunctions.UIClick && args.Function != EngineKeyFunctions.UIRightClick)
|
||||
return;
|
||||
|
||||
if (args.Function == EngineKeyFunctions.UIRightClick)
|
||||
Depress(args, true);
|
||||
|
||||
ActionPressed?.Invoke(args, this);
|
||||
}
|
||||
|
||||
private void OnUnpressed(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
if (args.Function != EngineKeyFunctions.UIClick && args.Function != EngineKeyFunctions.UIRightClick)
|
||||
return;
|
||||
|
||||
if (args.Function == EngineKeyFunctions.UIRightClick)
|
||||
Depress(args, false);
|
||||
|
||||
ActionUnpressed?.Invoke(args, this);
|
||||
}
|
||||
|
||||
@@ -378,12 +382,6 @@ public sealed class ActionButton : Control, IEntityControl
|
||||
if (_action is not {Enabled: true})
|
||||
return;
|
||||
|
||||
if (_depressed && !depress)
|
||||
{
|
||||
// fire the action
|
||||
OnUnpressed(args);
|
||||
}
|
||||
|
||||
_depressed = depress;
|
||||
DrawModeChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user