mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update
This commit is contained in:
@@ -89,35 +89,23 @@ end
|
||||
|
||||
--- Translate the text by locale_id
|
||||
---@param locale_id string Locale id
|
||||
---@param a string|nil Optional param to string.format
|
||||
---@param b string|nil Optional param to string.format
|
||||
---@param c string|nil Optional param to string.format
|
||||
---@param d string|nil Optional param to string.format
|
||||
---@param e string|nil Optional param to string.format
|
||||
---@param f string|nil Optional param to string.format
|
||||
---@param g string|nil Optional param to string.format
|
||||
---@param ... string Optional params for string.format
|
||||
---@return druid.lang_text Current instance
|
||||
function M:translate(locale_id, a, b, c, d, e, f, g)
|
||||
self.last_locale_args = { a, b, c, d, e, f, g }
|
||||
function M:translate(locale_id, ...)
|
||||
self.last_locale_args = { ... }
|
||||
self.last_locale = locale_id or self.last_locale
|
||||
self.text:set_text(settings.get_text(self.last_locale, a, b, c, d, e, f, g) or "")
|
||||
self.text:set_text(settings.get_text(self.last_locale, ...) or "")
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Format string with new text params on localized text
|
||||
---@param a string|nil Optional param to string.format
|
||||
---@param b string|nil Optional param to string.format
|
||||
---@param c string|nil Optional param to string.format
|
||||
---@param d string|nil Optional param to string.format
|
||||
---@param e string|nil Optional param to string.format
|
||||
---@param f string|nil Optional param to string.format
|
||||
---@param g string|nil Optional param to string.format
|
||||
---@param ... string Optional params for string.format
|
||||
---@return druid.lang_text Current instance
|
||||
function M:format(a, b, c, d, e, f, g)
|
||||
self.last_locale_args = { a, b, c, d, e, f, g }
|
||||
self.text:set_text(settings.get_text(self.last_locale, a, b, c, d, e, f, g) or "")
|
||||
function M:format(...)
|
||||
self.last_locale_args = { ... }
|
||||
self.text:set_text(settings.get_text(self.last_locale, ...) or "")
|
||||
|
||||
return self
|
||||
end
|
||||
|
@@ -288,14 +288,16 @@ function M:refresh_layout()
|
||||
local new_row_width = width * (0.5 - layout_pivot_offset.x)
|
||||
|
||||
-- Compare with eps due the float loss and element flickering
|
||||
if current_x + node_width - new_row_width > 0.0001 then
|
||||
if current_x + node_width - new_row_width > 0.00001 then
|
||||
current_y = current_y - row.height - margin.y
|
||||
|
||||
if row_index < #rows then
|
||||
row_index = row_index + 1
|
||||
row = rows[row_index]
|
||||
end
|
||||
|
||||
current_x = -row.width * (0.5 + layout_pivot_offset.x)
|
||||
current_y = current_y - row.height - margin.y
|
||||
|
||||
if is_justify and row.count > 1 then
|
||||
current_x = -max_width * (0.5 + layout_pivot_offset.x)
|
||||
end
|
||||
|
Reference in New Issue
Block a user