Flatten Element structure for simplicity
This commit is contained in:
parent
f23c10c160
commit
8b1228fa9e
@ -5,14 +5,10 @@ local Element = {
|
||||
y = 1,
|
||||
width = 1,
|
||||
height = 1,
|
||||
color = {
|
||||
bg = colors.black,
|
||||
fg = colors.white
|
||||
},
|
||||
render = {
|
||||
window = nil,
|
||||
parent = nil
|
||||
},
|
||||
bgColor = colors.black,
|
||||
fgColor = colors.white,
|
||||
window = nil,
|
||||
parent = nil,
|
||||
visible = true,
|
||||
dirty = true,
|
||||
id = "",
|
||||
@ -31,7 +27,7 @@ function Element:new(o)
|
||||
setmetatable(obj, self)
|
||||
obj.__index = obj
|
||||
|
||||
if obj.render and obj.render.parent then
|
||||
if obj.parent then
|
||||
obj:_reload()
|
||||
end
|
||||
|
||||
@ -84,17 +80,17 @@ function Element:setParent(parent)
|
||||
end
|
||||
|
||||
function Element:setFgColor(color)
|
||||
if color ~= self.color.fg then
|
||||
if color ~= self.fgColor then
|
||||
self:setDirty()
|
||||
self.color.fg = color
|
||||
self.fgColor = color
|
||||
self.render.window.setTextColor(color)
|
||||
end
|
||||
end
|
||||
|
||||
function Element:setBgColor(color)
|
||||
if color ~= self.color.bg then
|
||||
if color ~= self.bgColor then
|
||||
self:setDirty()
|
||||
self.color.bg = color
|
||||
self.bgColor = color
|
||||
self.render.window.setBackgroundColor(color)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user