mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Merge branch 'develop' into 102-input-priority
This commit is contained in:
@@ -108,11 +108,16 @@ end
|
||||
|
||||
|
||||
-- @tparam node click_node Button node to enabled input component
|
||||
-- @tparam node text_node Text node what will be changed on user input
|
||||
-- @tparam node|druid.text text_node Text node what will be changed on user input. You can pass text component instead of text node name
|
||||
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
|
||||
function Input.init(self, click_node, text_node, keyboard_type)
|
||||
self.druid = self:get_druid(self)
|
||||
self.text = self.druid:new_text(text_node)
|
||||
|
||||
if type(text_node) == const.TABLE then
|
||||
self.text = text_node
|
||||
else
|
||||
self.text = self.druid:new_text(text_node)
|
||||
end
|
||||
|
||||
self.is_selected = false
|
||||
self.value = self.text.last_value
|
||||
|
@@ -21,7 +21,7 @@ local LangText = component.create("lang_text", { component.ON_LANGUAGE_CHANGE })
|
||||
--- Component init function
|
||||
-- @tparam LangText self
|
||||
-- @tparam node node The text node
|
||||
-- @tparam string locale_id Default locale id
|
||||
-- @tparam string locale_id Default locale id, optional
|
||||
-- @tparam bool no_adjust If true, will not correct text size
|
||||
function LangText.init(self, node, locale_id, no_adjust)
|
||||
self.druid = self:get_druid()
|
||||
@@ -30,7 +30,9 @@ function LangText.init(self, node, locale_id, no_adjust)
|
||||
|
||||
self.on_change = Event()
|
||||
|
||||
self:translate(locale_id)
|
||||
if locale_id then
|
||||
self:translate(locale_id)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -59,7 +61,7 @@ end
|
||||
function LangText.translate(self, locale_id, ...)
|
||||
self.last_locale_args = {...}
|
||||
self.last_locale = locale_id or self.last_locale
|
||||
self.text:set_to(settings.get_text(self.last_locale, ...))
|
||||
self.text:set_to(settings.get_text(self.last_locale, ...) or "")
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user