Skip to content

Commit f734167

Browse files
committed
Fix some contexts for shortcut actions
These actions should only be triggered when the part of the GUI is being interacted with, assessed from the mouse hovering over it. Also makes sure we don't print any messages if there are no selected notes.
1 parent ebc34f8 commit f734167

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

gui/views/note_map/NoteMap.gd

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,19 @@ func _gui_input(event: InputEvent) -> void:
150150

151151

152152
func _shortcut_input(event: InputEvent) -> void:
153-
if Controller.is_song_editing_locked():
153+
if not _note_cursor_visible || Controller.is_song_editing_locked():
154154
return
155155

156156
if event.is_action_pressed("bosca_notemap_cursor_bigger", true, true):
157157
_adjust_note_cursor(1)
158+
get_viewport().set_input_as_handled()
158159
elif event.is_action_pressed("bosca_notemap_cursor_smaller", true, true):
159160
_adjust_note_cursor(-1)
160-
elif event.is_action_pressed("ui_copy"):
161+
get_viewport().set_input_as_handled()
162+
elif event.is_action_pressed("ui_copy", false, true):
161163
_copy_selected_notes()
162164
get_viewport().set_input_as_handled()
163-
elif event.is_action_pressed("ui_paste"):
165+
elif event.is_action_pressed("ui_paste", false, true):
164166
_paste_selected_notes()
165167
get_viewport().set_input_as_handled()
166168

@@ -839,7 +841,8 @@ func _copy_selected_notes() -> void:
839841

840842
_note_copied_buffer[i] = relative_data
841843

842-
Controller.update_status("SELECTED NOTES COPIED", Controller.StatusLevel.INFO)
844+
if not _note_copied_buffer.is_empty():
845+
Controller.update_status("SELECTED NOTES COPIED", Controller.StatusLevel.INFO)
843846

844847

845848
func _paste_selected_notes() -> void:

gui/views/pattern_map/PatternMap.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,15 @@ func _gui_input(event: InputEvent) -> void:
159159

160160

161161
func _shortcut_input(event: InputEvent) -> void:
162+
if not _hovering || Controller.is_song_editing_locked():
163+
return
164+
162165
if event.is_action_pressed("bosca_patternmap_scale_bigger", true, true):
163166
_resize_pattern_width(1)
167+
get_viewport().set_input_as_handled()
164168
elif event.is_action_pressed("bosca_patternmap_scale_smaller", true, true):
165169
_resize_pattern_width(-1)
170+
get_viewport().set_input_as_handled()
166171

167172

168173
func _physics_process(_delta: float) -> void:

gui/views/pattern_map/PatternMapTrack.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ func _shortcut_input(event: InputEvent) -> void:
113113
if not _hovering || Controller.is_song_editing_locked():
114114
return
115115

116-
if event.is_action_pressed("ui_copy"):
116+
if event.is_action_pressed("ui_copy", false, true):
117117
_copy_bars_in_loop()
118118
get_viewport().set_input_as_handled()
119-
elif event.is_action_pressed("ui_paste"):
119+
elif event.is_action_pressed("ui_paste", false, true):
120120
_paste_bars_at_cursor()
121121
get_viewport().set_input_as_handled()
122122

0 commit comments

Comments
 (0)