1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Fix a bug where the selection got stuck to the canvas boundaries when they were 1px away from them

This commit is contained in:
Manolis Papadeas 2022-02-09 16:14:16 +02:00
parent a331d697ed
commit a3e933cf4f

View file

@ -192,7 +192,14 @@ func _move_with_arrow_keys(event: InputEvent) -> void:
var input := Vector2()
input.x = int(event.is_action("ui_right")) - int(event.is_action("ui_left"))
input.y = int(event.is_action("ui_down")) - int(event.is_action("ui_up"))
move_content(input.rotated(stepify(Global.camera.rotation, PI / 2)) * step)
var move := input.rotated(stepify(Global.camera.rotation, PI / 2))
# These checks are needed to fix a bug where the selection boundaries
# got stuck to the canvas boundaries when they were 1px away from them
if is_equal_approx(abs(move.x), 0):
move.x = 0
if is_equal_approx(abs(move.y), 0):
move.y = 0
move_content(move * step)
# Check if an event is a ui_up/down/left/right event-press