about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/main.lua b/main.lua
index f3618cf..b04e539 100644
--- a/main.lua
+++ b/main.lua
@@ -94,13 +94,7 @@ function love.draw()
     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)
-                 love.graphics.setColor(0.7,0.7,0.7)
-                 love.graphics.rectangle('line', x,y, 12,12)
-                 love.graphics.line(4,y+6, 16,y+6)
-                 love.graphics.line(10,y, 10,y+12)
-                 love.graphics.setColor(0, 0, 0)
-               end,
+        icon = icon.insert_drawing,
         onpress1 = function()
                      table.insert(lines, i, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
                    end})
@@ -1033,6 +1027,14 @@ end
 
 icon = {}
 
+function icon.insert_drawing(x, y)
+  love.graphics.setColor(0.7,0.7,0.7)
+  love.graphics.rectangle('line', x,y, 12,12)
+  love.graphics.line(4,y+6, 16,y+6)
+  love.graphics.line(10,y, 10,y+12)
+  love.graphics.setColor(0, 0, 0)
+end
+
 function icon.freehand(x, y)
   love.graphics.line(x+4,y+7,x+5,y+5)
   love.graphics.line(x+5,y+5,x+7,y+4)