about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-15 22:05:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-15 22:05:01 -0700
commite9e2ead1af3d084b642f84600a7c97e93f8416b6 (patch)
tree4ba54be685c611f93f064421feac02780ece0e30
parent58ce23d843bf6de713bd9db0806b55b1efe212e5 (diff)
downloadtext.love-e9e2ead1af3d084b642f84600a7c97e93f8416b6.tar.gz
esc to cancel a shape mid-click
-rw-r--r--main.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index ef9e059..aa9774a 100644
--- a/main.lua
+++ b/main.lua
@@ -503,6 +503,9 @@ function keychord_pressed(chord)
     lines[#lines+1] = ''
   elseif chord == 'C-x' then
     parse_into_exec_payload(lines[#lines])
+  elseif chord == 'escape' and love.mouse.isDown('1') then
+    local drawing = current_drawing()
+    drawing.pending = {}
   elseif chord == 'C-f' and not love.mouse.isDown('1') then
     current_mode = 'freehand'
   elseif chord == 'C-g' and not love.mouse.isDown('1') then
@@ -975,6 +978,8 @@ function draw_help_with_mouse_pressed(drawing)
     love.graphics.print("* Press 'p' to add a vertex to the polygon", 16+30,y)
     y = y+15
   end
+  love.graphics.print("* Press 'esc' then release the mouse button to cancel the current shape", 16+30,y)
+  y = y+15
   y = y+15
   if current_mode ~= 'line' then
     love.graphics.print("* Press 'l' to switch to drawing lines", 16+30,y)