From c4059beddfb22bb1bda8621172a56e141d9957ec Mon Sep 17 00:00:00 2001 From: Arron Washington Date: Wed, 30 Nov 2022 10:06:03 -0500 Subject: [PATCH] Tool shortcuts should ignore macOS Command modifier. (#784) * Tool shortcuts should ignore macOS Command modifier. This prevents common shortcuts like CMD+S (Save), CMD+C (Copy), etc, from activating a tool. * Fix formatting Co-authored-by: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> --- src/UI/ToolButtons.gd | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/UI/ToolButtons.gd b/src/UI/ToolButtons.gd index 817622681..89d792a8d 100644 --- a/src/UI/ToolButtons.gd +++ b/src/UI/ToolButtons.gd @@ -13,12 +13,18 @@ func _input(event: InputEvent) -> void: for tool_name in Tools.tools: # Handle tool shortcuts var t: Tools.Tool = Tools.tools[tool_name] if InputMap.has_action("right_" + t.shortcut + "_tool"): - if event.is_action_pressed("right_" + t.shortcut + "_tool") and !event.control: + if ( + event.is_action_pressed("right_" + t.shortcut + "_tool") + and (!event.control and !event.command) + ): # Shortcut for right button (with Alt) Tools.assign_tool(t.name, BUTTON_RIGHT) return if InputMap.has_action("left_" + t.shortcut + "_tool"): - if event.is_action_pressed("left_" + t.shortcut + "_tool") and !event.control: + if ( + event.is_action_pressed("left_" + t.shortcut + "_tool") + and (!event.control and !event.command) + ): # Shortcut for left button Tools.assign_tool(t.name, BUTTON_LEFT) return