From d8e5a1ce1258b788fabc74ab2dda85dce8ab22ad Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 11 May 2022 13:00:15 -0700 Subject: [PATCH] clip drawings inside the border --- main.lua | 4 ++-- 1 file 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