Skip to content

Commit

Permalink
Fix bug where using shortcuts to switch between frames also moved the…
Browse files Browse the repository at this point in the history
… selection, causing deletions
  • Loading branch information
OverloadedOrama committed Nov 26, 2023
1 parent bf2cd6e commit ab3fb9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/UI/Canvas/Selection.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends Node2D

enum SelectionOperation { ADD, SUBTRACT, INTERSECT }
const KEY_MOVE_ACTION_NAMES: PackedStringArray = ["ui_up", "ui_down", "ui_left", "ui_right"]
const KEY_MOVE_ACTION_NAMES: PackedStringArray = [&"ui_up", &"ui_down", &"ui_left", &"ui_right"]
const CLIPBOARD_FILE_PATH := "user://clipboard.txt"

# flags (additional properties of selection that can be toggled)
Expand Down Expand Up @@ -220,23 +220,23 @@ func _move_with_arrow_keys(event: InputEvent) -> void:
# Check if an event is a ui_up/down/left/right event-press
func _is_action_direction_pressed(event: InputEvent) -> bool:
for action in KEY_MOVE_ACTION_NAMES:
if event.is_action_pressed(action):
if event.is_action_pressed(action, false, true):
return true
return false


# Check if an event is a ui_up/down/left/right event release
func _is_action_direction(event: InputEvent) -> bool:
for action in KEY_MOVE_ACTION_NAMES:
if event.is_action(action):
if event.is_action(action, true):
return true
return false


# Check if an event is a ui_up/down/left/right event release
func _is_action_direction_released(event: InputEvent) -> bool:
for action in KEY_MOVE_ACTION_NAMES:
if event.is_action_released(action):
if event.is_action_released(action, true):
return true
return false

Expand Down

0 comments on commit ab3fb9a

Please sign in to comment.