mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Add on layout change initial support
This commit is contained in:
@@ -24,7 +24,7 @@ local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("text")
|
||||
local M = component.create("text", { const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local function update_text_size(self)
|
||||
@@ -107,6 +107,11 @@ function M.init(self, node, value, no_adjust)
|
||||
end
|
||||
|
||||
|
||||
function M.on_layout_change(self)
|
||||
self:set_to(self.last_value)
|
||||
end
|
||||
|
||||
|
||||
--- Calculate text width with font with respect to trailing space
|
||||
-- @function text:get_text_width
|
||||
-- @tparam[opt] string text
|
||||
|
Reference in New Issue
Block a user