about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-10 13:44:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-10 13:44:12 -0700
commit242a087016c81f944f84e9921c06b7883b2a92b3 (patch)
treef502311ec0b97c8b88f50f772ec1ded6364d4a6a
parentfcfe667fe9282d3de3efc1f4c0fc21b966d281ba (diff)
downloadlines.love-242a087016c81f944f84e9921c06b7883b2a92b3.tar.gz
set current_drawing_index with current_drawing
-rw-r--r--drawing.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/drawing.lua b/drawing.lua
index 65c1139..6f0c123 100644
--- a/drawing.lua
+++ b/drawing.lua
@@ -466,27 +466,29 @@ function Drawing.keychord_pressed(chord)
       smoothen(shape)
     end
   elseif chord == 'C-u' and not love.mouse.isDown('1') then
-    local _,drawing,_,p = Drawing.select_point_at_mouse()
+    local drawing_index,drawing,_,p = Drawing.select_point_at_mouse()
     if drawing then
       if Previous_drawing_mode == nil then
         Previous_drawing_mode = Current_drawing_mode
       end
       Current_drawing_mode = 'move'
       drawing.pending = {mode=Current_drawing_mode, target_point=p}
+      Lines.current_drawing_index = drawing_index
       Lines.current_drawing = drawing
     end
   elseif love.mouse.isDown('1') and chord == 'v' then
-    local _,drawing,_,p = Drawing.select_point_at_mouse()
+    local drawing_index,drawing,_,p = Drawing.select_point_at_mouse()
     if drawing then
       if Previous_drawing_mode == nil then
         Previous_drawing_mode = Current_drawing_mode
       end
       Current_drawing_mode = 'move'
       drawing.pending = {mode=Current_drawing_mode, target_point=p}
+      Lines.current_drawing_index = drawing_index
       Lines.current_drawing = drawing
     end
   elseif chord == 'C-n' and not love.mouse.isDown('1') then
-    local _,drawing,point_index,p = Drawing.select_point_at_mouse()
+    local drawing_index,drawing,point_index,p = Drawing.select_point_at_mouse()
     if drawing then
       if Previous_drawing_mode == nil then
         -- don't clobber
@@ -495,6 +497,7 @@ function Drawing.keychord_pressed(chord)
       Current_drawing_mode = 'name'
       p.name = ''
       drawing.pending = {mode=Current_drawing_mode, target_point=point_index}
+      Lines.current_drawing_index = drawing_index
       Lines.current_drawing = drawing
     end
   elseif chord == 'C-d' and not love.mouse.isDown('1') then