diff --git a/docs/modules/Hotkey.html b/docs/modules/Hotkey.html
index d33df50..3cd5a00 100644
--- a/docs/modules/Hotkey.html
+++ b/docs/modules/Hotkey.html
@@ -149,6 +149,12 @@
+
Returns:
+
+
+ Hotkey
+ Current instance
+
diff --git a/docs/modules/RichInput.html b/docs/modules/RichInput.html
index 4183c31..c8d62dc 100644
--- a/docs/modules/RichInput.html
+++ b/docs/modules/RichInput.html
@@ -82,11 +82,19 @@
+
+ get_text(self) |
+ GSet input field text |
+
init(self, template, nodes) |
The RichInput constructor |
+ set_allowed_characters(self, characters) |
+ Set allowed charaters for input field. |
+
+
set_placeholder(self, placeholder_text) |
Set placeholder text |
@@ -122,6 +130,33 @@
+ -
+
+ get_text(self)
+
+ -
+ GSet input field text
+
+
+
Parameters:
+
+
+ Returns:
+
+
+ string
+ Current input text
+
+
+
+
+
+
-
init(self, template, nodes)
@@ -150,6 +185,39 @@
+
+
-
+
+ set_allowed_characters(self, characters)
+
+ -
+ Set allowed charaters for input field.
+ See: https://defold.com/ref/stable/string/
+ ex: [%a%d] for alpha and numeric
+
+
+
Parameters:
+
+ - self
+ RichInput
+ RichInput
+
+ - characters
+ string
+ Regulax exp. for validate user input
+
+
+
+ Returns:
+
+
+ RichInput
+ Current instance
+
+
+
+
+
-
@@ -171,6 +239,12 @@
+
Returns:
+
+
+ RichInput
+ Current instance
+
diff --git a/docs/modules/Text.html b/docs/modules/Text.html
index aa91505..179c6cb 100644
--- a/docs/modules/Text.html
+++ b/docs/modules/Text.html
@@ -137,6 +137,10 @@
Set scale |
+ set_size(self, size) |
+ Set text area size |
+
+
set_text_adjust(self, adjust_type, minimal_scale) |
Set text adjust, refresh the current text visuals, if needed |
@@ -163,6 +167,10 @@
Current text color |
+ last_value |
+ The last text value |
+
+
node |
Text node |
@@ -489,6 +497,37 @@
+
+ -
+
+ set_size(self, size)
+
+ -
+ Set text area size
+
+
+
Parameters:
+
+ - self
+ Text
+ Text
+
+ - size
+ vector3
+ The new text area size
+
+
+
+ Returns:
+
+
+ Text
+ Current text instance
+
+
+
+
+
-
@@ -632,6 +671,26 @@
+
+
-
+
+ last_value
+
+ -
+ The last text value
+
+
+
+
+
+
+
+
-
diff --git a/druid/annotations.lua b/druid/annotations.lua
index 5843e13..6ad81de 100644
--- a/druid/annotations.lua
+++ b/druid/annotations.lua
@@ -1,8 +1,5 @@
-- luacheck: ignore
----@diagnostic disable: lowercase-global
----@diagnostic disable: missing-return
----@diagnostic disable: duplicate-doc-param
----@diagnostic disable: duplicate-set-field
+---@meta
---@class druid
local druid = {}
@@ -565,6 +562,7 @@ local druid__hotkey = {}
---@param self druid.hotkey @{Hotkey}
---@param keys string[]|hash[]|string|hash that have to be pressed before key pressed to activate
---@param callback_argument any|nil The argument to pass into the callback function
+---@return druid.hotkey Current instance
function druid__hotkey.add_hotkey(self, keys, callback_argument) end
--- The @{Hotkey} constructor
@@ -936,15 +934,28 @@ function druid__radio_group.set_state(self, index, is_instant) end
---@field root node Root node
local druid__rich_input = {}
+--- GSet input field text
+---@param self druid.rich_input @{RichInput}
+---@return string Current input text
+function druid__rich_input.get_text(self) end
+
--- The @{RichInput} constructor
---@param self druid.rich_input @{RichInput}
---@param template string The template string name
---@param nodes table Nodes table from gui.clone_tree
function druid__rich_input.init(self, template, nodes) end
+--- Set allowed charaters for input field.
+--- See: https://defold.com/ref/stable/string/ ex: [%a%d] for alpha and numeric
+---@param self druid.rich_input @{RichInput}
+---@param characters string Regulax exp. for validate user input
+---@return druid.rich_input Current instance
+function druid__rich_input.set_allowed_characters(self, characters) end
+
--- Set placeholder text
---@param self druid.rich_input @{RichInput}
---@param placeholder_text string|nil The placeholder text
+---@return druid.rich_input Current instance
function druid__rich_input.set_placeholder(self, placeholder_text) end
@@ -1305,6 +1316,7 @@ local druid__swipe__style = {}
---@class druid.text : druid.base_component
---@field adjust_type number Current text size adjust settings
---@field color vector3 Current text color
+---@field last_value string The last text value
---@field node node Text node
---@field node_id hash The node id of text node
---@field on_set_pivot druid.event On change pivot callback(self, pivot)
@@ -1374,6 +1386,12 @@ function druid__text.set_pivot(self, pivot) end
---@return druid.text Current text instance
function druid__text.set_scale(self, scale) end
+--- Set text area size
+---@param self druid.text @{Text}
+---@param size vector3 The new text area size
+---@return druid.text Current text instance
+function druid__text.set_size(self, size) end
+
--- Set text adjust, refresh the current text visuals, if needed
---@param self druid.text @{Text}
---@param adjust_type number|nil See const.TEXT_ADJUST. If pass nil - use current adjust type
diff --git a/druid/base/blocker.lua b/druid/base/blocker.lua
index 82fe72c..92fc414 100644
--- a/druid/base/blocker.lua
+++ b/druid/base/blocker.lua
@@ -51,7 +51,7 @@ function Blocker.on_input(self, action_id, action)
return false
end
- if not self:is_enabled(self.node) then
+ if not self:is_enabled() then
return false
end
diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua
index 1020597..5e4391d 100755
--- a/druid/base/scroll.lua
+++ b/druid/base/scroll.lua
@@ -621,8 +621,8 @@ function Scroll._check_points(self)
local temp_dist = math.huge
local temp_dist_on_inert = math.huge
- local index = false
- local index_on_inert = false
+ local index = -1
+ local index_on_inert = -1
local pos = self.position
for i = 1, #self.points do
@@ -647,7 +647,11 @@ function Scroll._check_points(self)
end
end
- self:scroll_to_index(index_on_inert or index)
+ if index_on_inert >= 0 then
+ self:scroll_to_index(index_on_inert)
+ else
+ self:scroll_to_index(index)
+ end
end
diff --git a/druid/base/text.lua b/druid/base/text.lua
index 90b7788..e46f2e5 100755
--- a/druid/base/text.lua
+++ b/druid/base/text.lua
@@ -53,6 +53,9 @@
--- Current text position
-- @tfield vector3 pos
+--- The last text value
+-- @tfield string last_value
+
--- Initial text node scale
-- @tfield vector3 start_scale
@@ -320,6 +323,19 @@ function Text.set_to(self, set_to)
end
+--- Set text area size
+-- @tparam Text self @{Text}
+-- @tparam vector3 size The new text area size
+-- @treturn Text Current text instance
+function Text.set_size(self, size)
+ self.start_size = size
+ self.text_area = vmath.vector3(size)
+ self.text_area.x = self.text_area.x * self.start_scale.x
+ self.text_area.y = self.text_area.y * self.start_scale.y
+ update_adjust(self)
+end
+
+
--- Set color
-- @tparam Text self @{Text}
-- @tparam vector4 color Color for node
diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua
index 9adcc70..68d3560 100644
--- a/druid/custom/rich_input/rich_input.lua
+++ b/druid/custom/rich_input/rich_input.lua
@@ -91,10 +91,32 @@ end
--- Set placeholder text
-- @tparam RichInput self @{RichInput}
-- @tparam string|nil placeholder_text The placeholder text
+-- @treturn RichInput Current instance
function RichInput.set_placeholder(self, placeholder_text)
self.placeholder:set_to(placeholder_text)
return self
end
+---GSet input field text
+-- @tparam RichInput self @{RichInput}
+-- @treturn string Current input text
+function RichInput.get_text(self)
+ return self.input:get_text()
+end
+
+
+--- Set allowed charaters for input field.
+-- See: https://defold.com/ref/stable/string/
+-- ex: [%a%d] for alpha and numeric
+-- @tparam RichInput self @{RichInput}
+-- @tparam string characters Regulax exp. for validate user input
+-- @treturn RichInput Current instance
+function RichInput.set_allowed_characters(self, characters)
+ self.input:set_allowed_characters(characters)
+
+ return self
+end
+
+
return RichInput
diff --git a/druid/extended/hotkey.lua b/druid/extended/hotkey.lua
index 7dd84e7..f6e4608 100644
--- a/druid/extended/hotkey.lua
+++ b/druid/extended/hotkey.lua
@@ -64,6 +64,7 @@ end
-- @tparam Hotkey self @{Hotkey}
-- @tparam string[]|hash[]|string|hash keys that have to be pressed before key pressed to activate
-- @tparam any|nil callback_argument The argument to pass into the callback function
+-- @treturn Hotkey Current instance
function Hotkey.add_hotkey(self, keys, callback_argument)
keys = keys or {}
if type(keys) == "string" then
diff --git a/druid/extended/input.lua b/druid/extended/input.lua
index a5bf991..319ee31 100755
--- a/druid/extended/input.lua
+++ b/druid/extended/input.lua
@@ -302,7 +302,7 @@ function Input.select(self)
self.style.on_select(self, self.button.node)
else
if self.style.IS_UNSELECT_ON_RESELECT then
- self:unselect(self)
+ self:unselect()
end
end
end