about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 8b8f90b..a09e580 100644
--- a/main.lua
+++ b/main.lua
@@ -171,8 +171,10 @@ function propagate_to_drawings(x,y, button)
 end
 
 function insert_point(points, x,y)
+  local px,py = pixels(x),pixels(y)
   for i,point in ipairs(points) do
-    if point.x == x and point.y == y then
+    local cx,cy = pixels(point.x), pixels(point.y)
+    if (cx-px)*(cx-px) + (cy-py)*(cy-py) < 16 then
       return i
     end
   end