Compare commits
No commits in common. "2f895e22b00dd886184825f9aa1cc9d466a6fbb9" and "8496be68329a8d59b7bdd6f0089b45afa696c92e" have entirely different histories.
2f895e22b0
...
8496be6832
30
gfx/list.lua
30
gfx/list.lua
@ -1,4 +1,3 @@
|
||||
local Event = require("gfx.event")
|
||||
local Element = require("gfx.element")
|
||||
local List = Element:new{
|
||||
children = {},
|
||||
@ -126,35 +125,6 @@ function List:findById(id)
|
||||
return nil
|
||||
end
|
||||
|
||||
function List:handleEvent(evt)
|
||||
if Element.handleEvent(self, evt) then
|
||||
return true
|
||||
end
|
||||
|
||||
if Event.isClickEvent(evt) then
|
||||
local wOffset = 0
|
||||
local hOffset = 0
|
||||
for _,child in ipairs(self.children) do
|
||||
if Event.containsClick(child, evt, -wOffset, -hOffset) then
|
||||
return child:handleEvent({Event.repositionEvent(evt, -wOffset, -hOffset)})
|
||||
end
|
||||
|
||||
if self:isVertical() then
|
||||
hOffset = hOffset + child:getHeight()
|
||||
else
|
||||
wOffset = wOffset + child:getWidth()
|
||||
end
|
||||
end
|
||||
return false
|
||||
else
|
||||
local handled = false
|
||||
for _,child in ipairs(self.children) do
|
||||
handled = child:handleEvent(evt) or handled
|
||||
end
|
||||
return handled
|
||||
end
|
||||
end
|
||||
|
||||
function List:_isDirty()
|
||||
if Element._isDirty(self) then
|
||||
return true
|
||||
|
@ -165,8 +165,8 @@ local PAGES = {
|
||||
table.insert(subset, found[i])
|
||||
end
|
||||
|
||||
local listResult = itemList(subset, state.width, function(element, x, y, source)
|
||||
print("Clicked: "..x.." "..y)
|
||||
local listResult = itemList(subset, state.width, function(group, x, y, source)
|
||||
print("Clicked: "..group:getDisplayName())
|
||||
end)
|
||||
listResult:setParent(state.monitor)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user