Compare commits
2 Commits
0e1c5a4fbb
...
8232f116a5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8232f116a5 | ||
![]() |
df8f9d4018 |
@ -186,7 +186,7 @@ function Element:redraw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Element:handleEvent(evt)
|
function Element:handleEvent(evt)
|
||||||
if Event.isClickEvent(evt) and Event.containsClick(self, evt, 0, 0) then
|
if Event.isClickEvent(evt) and Event.containsClick(self, evt) then
|
||||||
if self.onClick ~= nil then
|
if self.onClick ~= nil then
|
||||||
local x, y, source = Event.getClickParams(evt)
|
local x, y, source = Event.getClickParams(evt)
|
||||||
return not not self.onClick(self, x, y, source)
|
return not not self.onClick(self, x, y, source)
|
||||||
@ -203,10 +203,10 @@ end
|
|||||||
|
|
||||||
function Element:_reload()
|
function Element:_reload()
|
||||||
if self.parent ~= nil then
|
if self.parent ~= nil then
|
||||||
local window = window.create(self.parent, self:getX(), self:getY(), self:getWidth(), self:getHeight(), self:isVisible())
|
local win = window.create(self.parent, self:getX(), self:getY(), self:getWidth(), self:getHeight(), self:isVisible())
|
||||||
window.setBackgroundColor(self:getBgColor())
|
win.setBackgroundColor(self:getBgColor())
|
||||||
window.setTextColor(self:getFgColor())
|
win.setTextColor(self:getFgColor())
|
||||||
self:_setWindow(window)
|
self:_setWindow(win)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ end
|
|||||||
|
|
||||||
function Event.containsClick(element, evt, dX, dY)
|
function Event.containsClick(element, evt, dX, dY)
|
||||||
local x, y = Event.getClickParams(evt)
|
local x, y = Event.getClickParams(evt)
|
||||||
x = x + dX
|
x = x + (dX or 0)
|
||||||
y = y + dY
|
y = y + (dY or 0)
|
||||||
local eX, eY = element:getPos()
|
local eX, eY = element:getPos()
|
||||||
return x >= eX and x < (eX + element:getWidth()) and y >= eY and y < (eY + element:getHeight())
|
return x >= eX and x < (eX + element:getWidth()) and y >= eY and y < (eY + element:getHeight())
|
||||||
end
|
end
|
||||||
|
@ -133,7 +133,7 @@ function List:handleEvent(evt)
|
|||||||
|
|
||||||
if Event.isClickEvent(evt) then
|
if Event.isClickEvent(evt) then
|
||||||
-- If click is not inside list bounds, we can safely ignore it
|
-- 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
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ function Padding:handleEvent(evt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Event.isClickEvent(evt) then
|
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
|
else
|
||||||
return self.element:handleEvent(evt)
|
return self.element:handleEvent(evt)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user