about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-21 09:30:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-21 09:30:02 -0700
commit77ba9433d7172259953c3cfa2954b476b3a501ea (patch)
tree56f938e396aae6f55bc5456f58e8104ef4330d80
parent5d8e7a3cc6bde06cd8ef79bae66538b22d34b957 (diff)
downloadtext.love-77ba9433d7172259953c3cfa2954b476b3a501ea.tar.gz
one missing transition between shape modes
-rw-r--r--drawing.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/drawing.lua b/drawing.lua
index b7a0d3b..28794a3 100644
--- a/drawing.lua
+++ b/drawing.lua
@@ -349,6 +349,8 @@ function Drawing.keychord_pressed(chord)
       if drawing.pending.vertices == nil then
         drawing.pending.vertices = {drawing.pending.p1}
       end
+    elseif drawing.pending.mode == 'square' or drawing.pending.mode == 'rectangle' then
+      -- reuse existing vertices
     elseif drawing.pending.mode == 'circle' or drawing.pending.mode == 'arc' then
       drawing.pending.vertices = {drawing.pending.center}
     end
@@ -416,7 +418,7 @@ function Drawing.keychord_pressed(chord)
       drawing.pending.p1 = Drawing.insert_point(drawing.points, drawing.pending.points[1].x, drawing.pending.points[1].y)
     elseif drawing.pending.mode == 'circle' or drawing.pending.mode == 'arc' then
       drawing.pending.p1 = drawing.pending.center
-    elseif drawing.pending.mode == 'polygon' then
+    elseif drawing.pending.mode == 'polygon' or drawing.pending.mode == 'rectangle' or drawing.pending.mode == 'square' then
       drawing.pending.p1 = drawing.pending.vertices[1]
     end
     drawing.pending.mode = 'line'