1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Implement support for mouse buttons to be used as menu shortcuts - fixes #1070

Also maps the mouse thumb button 1 to undo, and the mouse thumb button 2 to redo.
This commit is contained in:
Emmanouil Papadeas 2024-10-30 14:25:34 +02:00
parent dafc2fb1d5
commit 6863adf957
2 changed files with 14 additions and 0 deletions

View file

@ -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={

View file

@ -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)