28 lines
No EOL
663 B
Lua
28 lines
No EOL
663 B
Lua
local ElementList = Object:extend()
|
|
|
|
function ElementList:initElements()
|
|
self.elements = {}
|
|
self.focusedElem = nil
|
|
end
|
|
|
|
function ElementList:addElement(name, element)
|
|
self.elements[name] = element
|
|
end
|
|
|
|
function ElementList:deleteElement(name)
|
|
self.elements[name] = nil
|
|
end
|
|
|
|
function ElementList:getVisibleElement(topLayer)
|
|
local visibleList = {}
|
|
for _, element in ipairs(self.elements) do
|
|
if (element ~= nil) then
|
|
if (element:getVisibility() and ((element.depth) < 0 == topLayer)) then
|
|
table.insert(visibleList, element)
|
|
end
|
|
end
|
|
end
|
|
return visibleList
|
|
end
|
|
|
|
return ElementList |