about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-11 13:00:15 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-11 13:01:13 -0700
commitd8e5a1ce1258b788fabc74ab2dda85dce8ab22ad (patch)
tree0a69344bb4ab832b62f35c74bba02d978db099f9 /main.lua
parent3bc61ed13f810aa102fae8f3549ace816c697b41 (diff)
downloadview.love-d8e5a1ce1258b788fabc74ab2dda85dce8ab22ad.tar.gz
clip drawings inside the border
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index 2a1a281..c2e6aa6 100644
--- a/main.lua
+++ b/main.lua
@@ -75,8 +75,8 @@ function love.update(dt)
   if love.mouse.isDown('1') then
     for i, line in ipairs(lines) do
       if type(line) == 'table' then
-        local y = love.mouse.getY()
-        if y >= line.y and y < line.y + line.h then
+        local x, y = love.mouse.getX(), love.mouse.getY()
+        if y >= line.y and y < line.y + line.h and x >= 12 and x < 12+line.w then
           lines.current = line
           process_drag(line,love.mouse.getX(),love.mouse.getY())
         end