diff --git a/Changelog.md b/Changelog.md index 1f7520f54..ba2e6aa63 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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. - 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 issue where undo/redo was not working properly for straight lines that went outside the canvas. ## [v0.6] - 06-01-2020 diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index e4387eb81..2afdc1617 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -173,12 +173,15 @@ func _input(event : InputEvent) -> void: # 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, ... # 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 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 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 == "RectSelect": handle_undo("Rectangle Select")