mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Solve #169 Fix on_layout_change
This commit is contained in:
@@ -40,11 +40,11 @@ BaseComponent.ALL_INTERESTS = {
|
||||
|
||||
-- Mapping from on_message method to specific method name
|
||||
BaseComponent.SPECIFIC_UI_MESSAGES = {
|
||||
[hash(BaseComponent.ON_FOCUS_LOST)] = "on_focus_lost",
|
||||
[hash(BaseComponent.ON_FOCUS_GAINED)] = "on_focus_gained",
|
||||
[hash(BaseComponent.ON_LAYOUT_CHANGE)] = "on_layout_change",
|
||||
[hash(BaseComponent.ON_MESSAGE_INPUT)] = "on_message_input",
|
||||
[hash(BaseComponent.ON_LANGUAGE_CHANGE)] = "on_language_change",
|
||||
[hash("layout_changed")] = BaseComponent.ON_LAYOUT_CHANGE, -- The message_id from Defold
|
||||
[hash(BaseComponent.ON_FOCUS_LOST)] = BaseComponent.ON_FOCUS_LOST,
|
||||
[hash(BaseComponent.ON_FOCUS_GAINED)] = BaseComponent.ON_FOCUS_GAINED,
|
||||
[hash(BaseComponent.ON_MESSAGE_INPUT)] = BaseComponent.ON_MESSAGE_INPUT,
|
||||
[hash(BaseComponent.ON_LANGUAGE_CHANGE)] = BaseComponent.ON_LANGUAGE_CHANGE,
|
||||
}
|
||||
|
||||
|
||||
|
@@ -38,7 +38,7 @@ M.ON_MESSAGE = "on_message"
|
||||
M.ON_LATE_INIT = "on_late_init"
|
||||
M.ON_FOCUS_LOST = "on_focus_lost"
|
||||
M.ON_FOCUS_GAINED = "on_focus_gained"
|
||||
M.ON_LAYOUT_CHANGE = "on_layout_changed"
|
||||
M.ON_LAYOUT_CHANGE = "on_layout_change"
|
||||
M.ON_MESSAGE_INPUT = "on_message_input"
|
||||
M.ON_LANGUAGE_CHANGE = "on_language_change"
|
||||
|
||||
|
@@ -78,7 +78,7 @@ end
|
||||
|
||||
|
||||
function Slider.on_layout_change(self)
|
||||
self:set(self.value, true)
|
||||
self:set(self.value)
|
||||
end
|
||||
|
||||
|
||||
|
@@ -87,6 +87,12 @@ function Timer.update(self, dt)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Timer.on_layout_change(self)
|
||||
self:set_to(self.last_value)
|
||||
end
|
||||
|
||||
|
||||
--- Set text to text field
|
||||
-- @tparam Timer self
|
||||
-- @tparam number set_to Value in seconds
|
||||
|
Reference in New Issue
Block a user