Update annotations

This commit is contained in:
Insality 2024-10-05 02:27:30 +03:00
parent 4a8bb214d2
commit 3c9f539376
5 changed files with 59 additions and 7 deletions

View File

@ -312,11 +312,13 @@ function druid__checkbox_group.set_state(self, indexes, is_instant) end
---@class druid.data_list : druid.base_component ---@class druid.data_list : druid.base_component
---@field grid druid.static_grid|druid.dynamic_grid The Druid Grid component ---@field grid druid.static_grid|druid.dynamic_grid The Druid Grid component
---@field last_index number The current last index of visual elements
---@field on_element_add druid.event On DataList visual element created Event callback(self, index, node, instance) ---@field on_element_add druid.event On DataList visual element created Event callback(self, index, node, instance)
---@field on_element_remove druid.event On DataList visual element created Event callback(self, index) ---@field on_element_remove druid.event On DataList visual element created Event callback(self, index)
---@field on_scroll_progress_change druid.event Event triggered when scroll progress is changed; event(self, progress_value) ---@field on_scroll_progress_change druid.event Event triggered when scroll progress is changed; event(self, progress_value)
---@field scroll druid.scroll The Druid scroll component ---@field scroll druid.scroll The Druid scroll component
---@field scroll_progress number The current progress of scroll posititon ---@field scroll_progress number The current progress of scroll posititon
---@field top_index number The current top index of visual elements
local druid__data_list = {} local druid__data_list = {}
--- Clear the DataList and refresh visuals --- Clear the DataList and refresh visuals
@ -712,7 +714,7 @@ function druid__input.select(self) end
--- Set cursor position in input field --- Set cursor position in input field
---@param self druid.input @{Input} ---@param self druid.input @{Input}
---@param cursor_index number|nil Cursor index for cursor position, if nil - will be set to the end of the text ---@param cursor_index number|nil Cursor index for cursor position, if nil - will be set to the end of the text
---@param start_index number|nils Start index for cursor position, if nil - will be set to the end of the text ---@param start_index number|nil Start index for cursor position, if nil - will be set to the end of the text
---@param end_index number|nil End index for cursor position, if nil - will be set to the start_index ---@param end_index number|nil End index for cursor position, if nil - will be set to the start_index
---@return druid.input Current input instance ---@return druid.input Current input instance
function druid__input.select_cursor(self, cursor_index, start_index, end_index) end function druid__input.select_cursor(self, cursor_index, start_index, end_index) end
@ -1024,7 +1026,10 @@ function druid__rich_input.set_text(self, text) end
---@class druid.rich_text : druid.base_component ---@class druid.rich_text : druid.base_component
---@field druid druid_instance The component druid instance ---@field druid druid_instance The component druid instance
---@field icon_prefab node The icon prefab node
---@field root node The root node of the Rich Text
---@field style druid.rich_text.style Component style params. ---@field style druid.rich_text.style Component style params.
---@field text_prefab node The text prefab node
local druid__rich_text = {} local druid__rich_text = {}
--- Split a word into it's characters --- Split a word into it's characters
@ -1040,6 +1045,11 @@ function druid__rich_text.clear() end
---@return druid.rich_text.lines_metrics ---@return druid.rich_text.lines_metrics
function druid__rich_text.get_line_metric() end function druid__rich_text.get_line_metric() end
--- Get current text
---@param self druid.rich_text @{RichText}
---@return string text
function druid__rich_text.get_text(self) end
--- Get all current words. --- Get all current words.
---@return table druid.rich_text.word[] ---@return table druid.rich_text.word[]
function druid__rich_text.get_words() end function druid__rich_text.get_words() end
@ -1962,7 +1972,7 @@ function helper.table_to_string(t) end
---@field scale vector3 ---@field scale vector3
---@field size vector3 ---@field size vector3
---@field metrics druid.rich_text.metrics ---@field metrics druid.rich_text.metrics
---@field pivot number @ The gui.PIVOT_* constant ---@field pivot userdata @ The gui.PIVOT_* constant
---@field text string ---@field text string
---@field shadow vector4 ---@field shadow vector4
---@field outline vector4 ---@field outline vector4
@ -1972,6 +1982,9 @@ function helper.table_to_string(t) end
---@field anchor number ---@field anchor number
---@field br boolean ---@field br boolean
---@field nobr boolean ---@field nobr boolean
---@field source_text string
---@field image_color vector4
---@field text_color vector4
---@class druid.rich_text.image ---@class druid.rich_text.image
---@field texture string ---@field texture string
@ -1992,6 +2005,15 @@ function helper.table_to_string(t) end
---@field default_animation string ---@field default_animation string
---@field node_prefab node ---@field node_prefab node
---@field text_prefab node ---@field text_prefab node
---@field text_scale vector3
---@field adjust_scale number
---@field default_texture string
---@field node_scale vector3
---@field is_multiline boolean
---@field text_leading number
---@field font hash
---@field width number
---@field height number
---@class GUITextMetrics ---@class GUITextMetrics
---@field width number ---@field width number

View File

@ -90,6 +90,15 @@
--- The component druid instance --- The component druid instance
-- @tfield DruidInstance druid @{DruidInstance} -- @tfield DruidInstance druid @{DruidInstance}
--- The root node of the Rich Text
-- @tfield node root
--- The text prefab node
-- @tfield node text_prefab
--- The icon prefab node
-- @tfield node icon_prefab
-- --
local component = require("druid.component") local component = require("druid.component")
@ -149,7 +158,7 @@ end
--- Set text for Rich Text --- Set text for Rich Text
-- @tparam RichText self @{RichText} -- @tparam RichText self @{RichText}
-- @tparam string text|nil The text to set -- @tparam string|nil text The text to set
-- @treturn druid.rich_text.word[] words -- @treturn druid.rich_text.word[] words
-- @treturn druid.rich_text.lines_metrics line_metrics -- @treturn druid.rich_text.lines_metrics line_metrics
-- @usage -- @usage
@ -210,6 +219,9 @@ function RichText.set_text(self, text)
end end
--- Get current text
-- @tparam RichText self @{RichText}
-- @treturn string text
function RichText.get_text(self) function RichText.get_text(self)
return self._last_value return self._last_value
end end

View File

@ -18,6 +18,12 @@
--- The current progress of scroll posititon --- The current progress of scroll posititon
-- @tfield number scroll_progress -- @tfield number scroll_progress
--- The current top index of visual elements
-- @tfield number top_index
--- The current last index of visual elements
-- @tfield number last_index
--- Event triggered when scroll progress is changed; event(self, progress_value) --- Event triggered when scroll progress is changed; event(self, progress_value)
-- @tfield DruidEvent on_scroll_progress_change @{DruidEvent} -- @tfield DruidEvent on_scroll_progress_change @{DruidEvent}

View File

@ -303,7 +303,7 @@ function Input.on_input(self, action_id, action)
return false return false
end end
return false return self.is_selected
end end
@ -484,7 +484,7 @@ end
--- Set cursor position in input field --- Set cursor position in input field
-- @tparam Input self @{Input} -- @tparam Input self @{Input}
-- @tparam number|nil cursor_index Cursor index for cursor position, if nil - will be set to the end of the text -- @tparam number|nil cursor_index Cursor index for cursor position, if nil - will be set to the end of the text
-- @tparam number|nils start_index Start index for cursor position, if nil - will be set to the end of the text -- @tparam number|nil start_index Start index for cursor position, if nil - will be set to the end of the text
-- @tparam number|nil end_index End index for cursor position, if nil - will be set to the start_index -- @tparam number|nil end_index End index for cursor position, if nil - will be set to the start_index
-- @treturn druid.input Current input instance -- @treturn druid.input Current input instance
function Input.select_cursor(self, cursor_index, start_index, end_index) function Input.select_cursor(self, cursor_index, start_index, end_index)

View File

@ -21,7 +21,7 @@
---@field scale vector3 ---@field scale vector3
---@field size vector3 ---@field size vector3
---@field metrics druid.rich_text.metrics ---@field metrics druid.rich_text.metrics
---@field pivot number @ The gui.PIVOT_* constant ---@field pivot userdata @ The gui.PIVOT_* constant
---@field text string ---@field text string
---@field shadow vector4 ---@field shadow vector4
---@field outline vector4 ---@field outline vector4
@ -31,6 +31,9 @@
---@field anchor number ---@field anchor number
---@field br boolean ---@field br boolean
---@field nobr boolean ---@field nobr boolean
---@field source_text string
---@field image_color vector4
---@field text_color vector4
---@class druid.rich_text.image ---@class druid.rich_text.image
---@field texture string ---@field texture string
@ -51,6 +54,15 @@
---@field default_animation string ---@field default_animation string
---@field node_prefab node ---@field node_prefab node
---@field text_prefab node ---@field text_prefab node
---@field text_scale vector3
---@field adjust_scale number
---@field default_texture string
---@field node_scale vector3
---@field is_multiline boolean
---@field text_leading number
---@field font hash
---@field width number
---@field height number
---@class GUITextMetrics ---@class GUITextMetrics
---@field width number ---@field width number