Skip to content

Commit

Permalink
Implement support for mouse buttons to be used as menu shortcuts - fixes
Browse files Browse the repository at this point in the history
 #1070

Also maps the mouse thumb button 1 to undo, and the mouse thumb button 2 to redo.
  • Loading branch information
OverloadedOrama committed Oct 30, 2024
1 parent dafc2fb commit 6863adf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ quit={
undo={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":90,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":8,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
redo={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":89,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":true,"pressed":false,"keycode":90,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(138, 9),"global_position":Vector2(147, 55),"factor":1.0,"button_index":9,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
show_grid={
Expand Down
12 changes: 12 additions & 0 deletions src/UI/TopMenuContainer/TopMenuContainer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ func _ready() -> void:
_setup_help_menu()


func _input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed:
file_menu.activate_item_by_event(event)
edit_menu.activate_item_by_event(event)
select_menu.activate_item_by_event(event)
image_menu.activate_item_by_event(event)
effects_menu.activate_item_by_event(event)
view_menu.activate_item_by_event(event)
window_menu.activate_item_by_event(event)
help_menu.activate_item_by_event(event)


func _notification(what: int) -> void:
if what == NOTIFICATION_TRANSLATION_CHANGED and Global.current_project != null:
_update_file_menu_buttons(Global.current_project)
Expand Down

0 comments on commit 6863adf

Please sign in to comment.