mirror of
https://github.com/Insality/druid
synced 2025-09-28 10:32:20 +02:00
Add on_style_change to every component
Empty default style is now valid. Every component have their default style values. Removed style function checks
This commit is contained in:
@@ -70,6 +70,18 @@ local function set_bar_to(self, set_to, is_silent)
|
||||
end
|
||||
|
||||
|
||||
--- Change style of component.
|
||||
-- This function can be called before component:init. This callback
|
||||
-- only for store component style params inside self context
|
||||
-- @function progress:on_style_change
|
||||
-- @tparam table style The component style table
|
||||
function M.on_style_change(self, style)
|
||||
self.style = {}
|
||||
self.style.SPEED = style.SPEED or 5
|
||||
self.style.MIN_DELTA = style.MIN_DELTA or 0.005
|
||||
end
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function progress:init
|
||||
-- @tparam string|node node Progress bar fill node or node name
|
||||
@@ -81,7 +93,6 @@ function M.init(self, node, key, init_value)
|
||||
self.prop = hash("scale."..key)
|
||||
self.key = key
|
||||
|
||||
self.style = self:get_style()
|
||||
self.node = self:get_node(node)
|
||||
self.scale = gui.get_scale(self.node)
|
||||
self.size = gui.get_size(self.node)
|
||||
|
Reference in New Issue
Block a user