about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-15 22:18:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-15 22:21:49 -0700
commitba49a5ee7478460a6a5b951a66d108e80078049b (patch)
tree476d5440923527e347579fe4733f4fed5bd210aa
parente9e2ead1af3d084b642f84600a7c97e93f8416b6 (diff)
downloadtext.love-ba49a5ee7478460a6a5b951a66d108e80078049b.tar.gz
some missing transitions
-rw-r--r--main.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index aa9774a..a01dd09 100644
--- a/main.lua
+++ b/main.lua
@@ -513,8 +513,12 @@ function keychord_pressed(chord)
   elseif love.mouse.isDown('1') and chord == 'g' then
     current_mode = 'polygon'
     local drawing = current_drawing()
-    if drawing.pending.mode == 'line' then
-      drawing.pending.vertices = {drawing.pending.p1}
+    if drawing.pending.mode == 'freehand' then
+      drawing.pending.vertices = {insert_point(drawing.points, drawing.pending.points[1].x, drawing.pending.points[1].y)}
+    elseif drawing.pending.mode == 'line' or drawing.pending.mode == 'manhattan' then
+      if drawing.pending.vertices == nil then
+        drawing.pending.vertices = {drawing.pending.p1}
+      end
     elseif drawing.pending.mode == 'circle' or drawing.pending.mode == 'arc' then
       drawing.pending.vertices = {drawing.pending.center}
     end
@@ -537,7 +541,9 @@ function keychord_pressed(chord)
   elseif love.mouse.isDown('1') and chord == 'c' then
     current_mode = 'circle'
     local drawing = current_drawing()
-    if drawing.pending.mode == 'line' then
+    if drawing.pending.mode == 'freehand' then
+      drawing.pending.center = insert_point(drawing.points, drawing.pending.points[1].x, drawing.pending.points[1].y)
+    elseif drawing.pending.mode == 'line' or drawing.pending.mode == 'manhattan' then
       drawing.pending.center = drawing.pending.p1
     elseif drawing.pending.mode == 'polygon' then
       drawing.pending.center = drawing.pending.vertices[1]
@@ -550,6 +556,8 @@ function keychord_pressed(chord)
       drawing.pending.p1 = 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
+      drawing.pending.p1 = drawing.pending.vertices[1]
     end
     drawing.pending.mode = 'line'
   elseif chord == 'C-l' then
@@ -561,7 +569,9 @@ function keychord_pressed(chord)
   elseif love.mouse.isDown('1') and chord == 'm' then
     current_mode = 'manhattan'
     local drawing = select_drawing_at_mouse()
-    if drawing.pending.mode == 'line' then
+    if drawing.pending.mode == 'freehand' then
+      drawing.pending.p1 = insert_point(drawing.points, drawing.pending.points[1].x, drawing.pending.points[1].y)
+    elseif drawing.pending.mode == 'line' then
       -- do nothing
     elseif drawing.pending.mode == 'polygon' then
       drawing.pending.p1 = drawing.pending.vertices[1]