diff --git a/gfx/event.lua b/gfx/event.lua index 9b01359..d179a6a 100644 --- a/gfx/event.lua +++ b/gfx/event.lua @@ -18,8 +18,8 @@ end function Event.containsClick(element, evt, dX, dY) local x, y = Event.getClickParams(evt) - x = x + dX - y = y + dY + x = x + (dX or 0) + y = y + (dY or 0) local eX, eY = element:getPos() return x >= eX and x < (eX + element:getWidth()) and y >= eY and y < (eY + element:getHeight()) end diff --git a/gfx/list.lua b/gfx/list.lua index 7e22ff2..e42942d 100644 --- a/gfx/list.lua +++ b/gfx/list.lua @@ -133,7 +133,7 @@ function List:handleEvent(evt) if Event.isClickEvent(evt) then -- If click is not inside list bounds, we can safely ignore it - if not Event.containsClick(self, evt, 0, 0) then + if not Event.containsClick(self, evt) then return false end diff --git a/gfx/padding.lua b/gfx/padding.lua index e4a5b22..b907568 100644 --- a/gfx/padding.lua +++ b/gfx/padding.lua @@ -86,7 +86,7 @@ function Padding:handleEvent(evt) end if Event.isClickEvent(evt) then - return self.element:handleEvent({Event.repositionEvent(evt, -self:getPaddingLeft(), -self:getPaddingTop())}) + return Event.containsClick(self, evt) and self.element:handleEvent({Event.repositionEvent(evt, -self:getPaddingLeft(), -self:getPaddingTop())}) else return self.element:handleEvent(evt) end