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

Fixed issue where undo/redo was not working properly for straight lines that went outside the canvas

This commit is contained in:
OverloadedOrama 2020-01-13 01:11:03 +02:00
parent ff758467dd
commit 542f709a8f
2 changed files with 6 additions and 2 deletions

View file

@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed crash on Godot 3.2.beta6 when pressing the Edit Palette button. - Fixed crash on Godot 3.2.beta6 when pressing the Edit Palette button.
- The canvas updates automatically when onion skinning settings change. - The canvas updates automatically when onion skinning settings change.
- Fixed a rare crash with straight lines. It was possible that the variable `is_making_line` could be true, even if the line itself has been freed from memory. - Fixed a rare crash with straight lines. It was possible that the variable `is_making_line` could be true, even if the line itself has been freed from memory.
- Fixed issue where undo/redo was not working properly for straight lines that went outside the canvas.
## [v0.6] - 06-01-2020 ## [v0.6] - 06-01-2020

View file

@ -173,12 +173,15 @@ func _input(event : InputEvent) -> void:
# If we're already pressing a mouse button and we haven't handled undo yet,... # If we're already pressing a mouse button and we haven't handled undo yet,...
#. .. it means that the cursor was outside the canvas. Then, ... #. .. it means that the cursor was outside the canvas. Then, ...
# simulate "just pressed" logic the moment the cursor gets inside the canvas # simulate "just pressed" logic the moment the cursor gets inside the canvas
# Or, if we're making a line. This is used for handling undo/redo for lines...
# ...that go outside the canvas
if Input.is_action_pressed("left_mouse") || Input.is_action_pressed("right_mouse"): if Input.is_action_pressed("left_mouse") || Input.is_action_pressed("right_mouse"):
if mouse_in_canvas && Global.undos < Global.undo_redo.get_version(): if (mouse_in_canvas && Global.undos < Global.undo_redo.get_version()) || is_making_line:
mouse_pressed = true mouse_pressed = true
if mouse_pressed: if mouse_pressed:
if can_handle && Global.current_frame == frame: if (can_handle || is_making_line) && Global.current_frame == frame:
if current_action != "None" && current_action != "ColorPicker": if current_action != "None" && current_action != "ColorPicker":
if current_action == "RectSelect": if current_action == "RectSelect":
handle_undo("Rectangle Select") handle_undo("Rectangle Select")