Bubble unhandled double-click events to OnClick.

This commit is contained in:
Paul Chote
2022-12-21 10:06:53 +13:00
committed by abcdefg30
parent f4965915ee
commit 360a5b293d

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets
// Equivalent to OnMouseUp, but without an input arg // Equivalent to OnMouseUp, but without an input arg
public Action OnClick = () => { }; public Action OnClick = () => { };
public Action OnDoubleClick = () => { }; public Action OnDoubleClick = null;
public Action<KeyInput> OnKeyPress = _ => { }; public Action<KeyInput> OnKeyPress = _ => { };
public string Cursor = ChromeMetrics.Get<string>("ButtonCursor"); public string Cursor = ChromeMetrics.Get<string>("ButtonCursor");
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Widgets
return false; return false;
var disabled = IsDisabled(); var disabled = IsDisabled();
if (HasMouseFocus && mi.Event == MouseInputEvent.Up && mi.MultiTapCount == 2) if (HasMouseFocus && mi.Event == MouseInputEvent.Up && mi.MultiTapCount == 2 && OnDoubleClick != null)
{ {
if (!disabled) if (!disabled)
{ {