Small color fix for labels
fixed bug with foreground/background colors, when using xml
This commit is contained in:
@@ -12,6 +12,8 @@ return function(name, basalt)
|
||||
base:setSize(5, 1)
|
||||
base:setBackground(false)
|
||||
|
||||
local fgChanged = false
|
||||
|
||||
local autoSize = true
|
||||
local text, textAlign = "Label", "left"
|
||||
|
||||
@@ -47,6 +49,12 @@ return function(name, basalt)
|
||||
return self
|
||||
end,
|
||||
|
||||
setForeground = function(self, col)
|
||||
base.setForeground(self, col)
|
||||
fgChanged = true
|
||||
return self
|
||||
end,
|
||||
|
||||
--- Returns the label's autoSize property.
|
||||
--- @return boolean
|
||||
getAutoSize = function(self)
|
||||
@@ -105,7 +113,9 @@ return function(name, basalt)
|
||||
init = function(self)
|
||||
base.init(self)
|
||||
local parent = self:getParent()
|
||||
self:setForeground(parent:getForeground())
|
||||
if not(fgChanged)then
|
||||
self:setForeground(parent:getForeground())
|
||||
end
|
||||
end
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ return {
|
||||
else
|
||||
Reactive.effect(function()
|
||||
local value = load("return " .. expression, nil, "t", env)()
|
||||
if(colors[value]~=nil)then value = colors[value] end
|
||||
object:setProperty(attribute, value)
|
||||
end)
|
||||
end
|
||||
@@ -138,4 +139,4 @@ return {
|
||||
}
|
||||
return object
|
||||
end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user