diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-07-05 11:04:39 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-07-05 11:06:55 -0700 |
commit | 3422d92a00bcf6220f6a4bb25f1f4c718e7c9555 (patch) | |
tree | ae8cc89f92db745bc44dc068f689f28b2f2beda2 /drawing.lua | |
parent | 3197bb57391427cc7823d813d02bf2b6e311c0e1 (diff) | |
download | lines.love-3422d92a00bcf6220f6a4bb25f1f4c718e7c9555.tar.gz |
bugfix: 'escape' to cancel a stroke
This has been broken since commit b544e8c357 on May 17 :/ I'm just undoing that commit, which turns out to be completely unnecessary. And adding a test.
Diffstat (limited to 'drawing.lua')
-rw-r--r-- | drawing.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drawing.lua b/drawing.lua index 04bf1d2..cff5620 100644 --- a/drawing.lua +++ b/drawing.lua @@ -287,7 +287,9 @@ function Drawing.mouse_released(x,y, button) elseif Lines.current_drawing then local drawing = Lines.current_drawing if drawing.pending then - if drawing.pending.mode == 'freehand' then + if drawing.pending.mode == nil then + -- nothing pending + elseif drawing.pending.mode == 'freehand' then -- the last point added during update is good enough table.insert(drawing.shapes, drawing.pending) elseif drawing.pending.mode == 'line' then @@ -540,6 +542,9 @@ function Drawing.keychord_pressed(chord) if drawing then drawing.show_help = true end + elseif chord == 'escape' and App.mouse_down(1) then + local _,drawing = Drawing.current_drawing() + drawing.pending = {} end end |