about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-16 22:29:05 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-16 22:29:05 -0700
commit04dc87482d05876ad2003f9d2e42cd555bf4f16c (patch)
tree5ce02be2ef35035d3f59fb3fcd2ea9056bc1453a
parent3a9f02c9f26f9f773ff003a7792aabbb4064f062 (diff)
downloadlines.love-04dc87482d05876ad2003f9d2e42cd555bf4f16c.tar.gz
save each line's y coordinate, whether it's a drawing or not
-rw-r--r--main.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index da0b3cd..773a43b 100644
--- a/main.lua
+++ b/main.lua
@@ -89,6 +89,7 @@ function love.draw()
   local y = 0
   for i,line in ipairs(lines) do
     y = y+25
+    line.y = y
     if line.mode == 'text' and line.data == '' then
       button('draw', {x=4,y=y+4, w=12,h=12, color={1,1,0},
         icon = function(x,y)
@@ -107,7 +108,6 @@ function love.draw()
         end
     elseif line.mode == 'drawing' then
       -- line drawing
-      line.y = y
       y = y+pixels(line.h)
 
       local pmx,pmy = love.mouse.getX(), love.mouse.getY()