Update annotations

This commit is contained in:
Insality
2024-11-10 20:34:30 +01:00
parent b5ccd80215
commit 56ef92a1b5
16 changed files with 21 additions and 158 deletions

View File

@@ -56,7 +56,6 @@ local M = component.create("data_list")
--- The DataList constructor
---@param self DataList DataList
---@param scroll Scroll The Scroll instance for Data List component
---@param grid StaticGrid The StaticGrid} or @{DynamicGrid instance for Data List component
---@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component])
@@ -87,7 +86,6 @@ end
--- Druid System on_remove function
---@param self DataList DataList
function M:on_remove()
self:clear()
self.scroll.on_scroll:unsubscribe(self._refresh, self)
@@ -95,7 +93,6 @@ end
--- Set refresh function for DataList component
---@param self DataList DataList
---@param is_use_cache boolean Use cache version of DataList. Requires make setup of components in on_element_add callback and clean in on_element_remove
---@return druid.data_list Current DataList instance
function M:set_use_cache(is_use_cache)
@@ -105,7 +102,6 @@ end
--- Set new data set for DataList component
---@param self DataList DataList
---@param data table The new data array
---@return druid.data_list Current DataList instance
function M:set_data(data)
@@ -117,7 +113,6 @@ end
--- Return current data from DataList component
---@param self DataList DataList
---@return table The current data array
function M:get_data()
return self._data
@@ -125,7 +120,6 @@ end
--- Add element to DataList. Currenly untested
---@param self DataList DataList
---@param data table
---@param index number|nil
---@param shift_policy number|nil The constant from const.SHIFT.*
@@ -139,7 +133,6 @@ end
--- Remove element from DataList. Currenly untested
---@param self DataList DataList
---@param index number|nil
---@param shift_policy number|nil The constant from const.SHIFT.*
function M:remove(index, shift_policy)
@@ -149,7 +142,6 @@ end
--- Remove element from DataList by data value. Currenly untested
---@param self DataList DataList
---@param data table
---@param shift_policy number|nil The constant from const.SHIFT.*
function M:remove_by_data(data, shift_policy)
@@ -162,7 +154,6 @@ end
--- Clear the DataList and refresh visuals
---@param self DataList DataList
function M:clear()
self._data = {}
self:_refresh()
@@ -170,7 +161,6 @@ end
--- Return index for data value
---@param self DataList DataList
---@param data table
function M:get_index(data)
for index, value in pairs(self._data) do
@@ -184,7 +174,6 @@ end
--- Return all currenly created nodes in DataList
---@param self DataList DataList
---@return node[] List of created nodes
function M:get_created_nodes()
local nodes = {}
@@ -198,7 +187,6 @@ end
--- Return all currenly created components in DataList
---@param self DataList DataList
---@return druid.base_component[] List of created nodes
function M:get_created_components()
local components = {}
@@ -212,7 +200,6 @@ end
--- Instant scroll to element with passed index
---@param self DataList DataList
---@param index number
function M:scroll_to_index(index)
local pos = self.grid:get_pos(index)
@@ -221,7 +208,6 @@ end
--- Add element at passed index using cache or create new
---@param self DataList DataList
---@param index number
---@private
function M:_add_at(index)
@@ -255,7 +241,6 @@ end
--- Remove element from passed index and add it to cache if applicable
---@param self DataList DataList
---@param index number
---@private
function M:_remove_at(index)
@@ -286,7 +271,6 @@ end
--- Refresh all elements in DataList
---@param self DataList DataList
---@private
function M:_refresh()
self.scroll:set_size(self.grid:get_size_for(#self._data))

View File

@@ -38,7 +38,6 @@ local M = component.create("hotkey")
--- The Hotkey constructor
---@param self Hotkey Hotkey
---@param keys string[]|string The keys to be pressed for trigger callback. Should contains one key and any modificator keys
---@param callback function The callback function
---@param callback_argument any|nil The argument to pass into the callback function
@@ -73,7 +72,6 @@ end
--- Add hotkey for component callback
---@param self 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 Hotkey Current instance
@@ -174,7 +172,6 @@ end
--- If true, the callback will be triggered on action.repeated
---@param self Hotkey Hotkey
---@param is_enabled_repeated bool The flag value
---@return Hotkey
function M:set_repeat(is_enabled_repeated)

View File

@@ -156,7 +156,6 @@ end
--- The Input constructor
---@param self Input Input
---@param click_node node Node to enabled input component
---@param text_node node|Text Text node what will be changed on user input. You can pass text component instead of text node name Text
---@param keyboard_type number|nil Gui keyboard type for input field
@@ -328,7 +327,6 @@ function M:get_text_selected()
end
--- Replace selected text with new text
---@param self Input Input
---@param text string The text to replace selected text
---@return string New input text
function M:get_text_selected_replaced(text)
@@ -346,7 +344,6 @@ end
--- Set text for input field
---@param self Input Input
---@param input_text string The string to apply for input field
function M:set_text(input_text)
input_text = tostring(input_text or "")
@@ -395,7 +392,6 @@ end
--- Select input field. It will show the keyboard and trigger on_select events
---@param self Input Input
function M:select()
gui.reset_keyboard()
self.marked_value = ""
@@ -420,7 +416,6 @@ end
--- Remove selection from input. It will hide the keyboard and trigger on_unselect events
---@param self Input Input
function M:unselect()
gui.reset_keyboard()
self.marked_value = ""
@@ -439,7 +434,6 @@ end
--- Return current input field text
---@param self Input Input
---@return string The current input field text
function M:get_text()
if self.marked_value ~= "" then
@@ -452,7 +446,6 @@ end
--- Set maximum length for input field.
-- Pass nil to make input field unliminted (by default)
---@param self Input Input
---@param max_length number Maximum length for input text field
---@return druid.input Current input instance
function M:set_max_length(max_length)
@@ -464,7 +457,6 @@ end
--- Set allowed charaters for input field.
-- See: https://defold.com/ref/stable/string/
-- ex: [%a%d] for alpha and numeric
---@param self Input Input
---@param characters string Regulax exp. for validate user input
---@return druid.input Current input instance
function M:set_allowed_characters(characters)
@@ -474,7 +466,6 @@ end
--- Reset current input selection and return previous value
---@param self Input Input
---@return druid.input Current input instance
function M:reset_changes()
self:set_text(self.previous_value)
@@ -484,7 +475,6 @@ end
--- Set cursor position in input field
---@param self Input Input
---@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|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
@@ -507,7 +497,6 @@ end
--- Change cursor position by delta
---@param self Input Input
---@param delta number side for cursor position, -1 for left, 1 for right
---@param is_add_to_selection boolean (Shift key)
---@param is_move_to_end boolean (Ctrl key)

View File

@@ -42,7 +42,6 @@ local M = component.create("lang_text")
--- The LangText constructor
---@param self LangText LangText
---@param node string|node The node_id or gui.get_node(node_id)
---@param locale_id string|nil Default locale id or text from node as default
---@param adjust_type string|nil Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
@@ -69,7 +68,6 @@ end
--- Setup raw text to lang_text component
---@param self LangText LangText
---@param text string Text for text node
---@return LangText Current instance
function M:set_to(text)
@@ -82,7 +80,6 @@ end
--- Translate the text by locale_id
---@param self LangText LangText
---@param locale_id string Locale id
---@param a string|nil Optional param to string.format
---@param b string|nil Optional param to string.format
@@ -102,7 +99,6 @@ end
--- Format string with new text params on localized text
---@param self LangText LangText
---@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

View File

@@ -131,7 +131,6 @@ end
--- The Progress constructor
---@param self Progress Progress
---@param node string|node Node name or GUI Node itself.
---@param key string Progress bar direction: const.SIDE.X or const.SIDE.Y
---@param init_value number|nil Initial value of progress bar. Default: 1
@@ -193,21 +192,18 @@ end
--- Fill a progress bar and stop progress animation
---@param self Progress Progress
function M:fill()
set_bar_to(self, 1, true)
end
--- Empty a progress bar
---@param self Progress Progress
function M:empty()
set_bar_to(self, 0, true)
end
--- Instant fill progress bar to value
---@param self Progress Progress
---@param to number Progress bar value, from 0 to 1
function M:set_to(to)
to = helper.clamp(to, 0, 1)
@@ -216,14 +212,12 @@ end
--- Return current progress bar value
---@param self Progress Progress
function M:get()
return self.last_value
end
--- Set points on progress bar to fire the callback
---@param self Progress Progress
---@param steps number[] Array of progress bar values
---@param callback function Callback on intersect step value
-- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
@@ -234,7 +228,6 @@ end
--- Start animation of a progress bar
---@param self Progress Progress
---@param to number value between 0..1
---@param callback function|nil Callback on animation ends
function M:to(to, callback)
@@ -253,7 +246,6 @@ end
--- Set progress bar max node size
---@param self Progress Progress
---@param max_size vector3 The new node maximum (full) size
---@return Progress Progress
function M:set_max_size(max_size)

View File

@@ -69,7 +69,6 @@ end
--- The Slider constructor
---@param self Slider Slider
---@param node node Gui pin node
---@param end_pos vector3 The end position of slider
---@param callback function|nil On slider change callback
@@ -197,7 +196,6 @@ end
--- Set value for slider
---@param self Slider Slider
---@param value number Value from 0 to 1
---@param is_silent boolean|nil Don't trigger event if true
function M:set(value, is_silent)
@@ -212,7 +210,6 @@ end
--- Set slider steps. Pin node will
-- apply closest step position
---@param self Slider Slider
---@param steps number[] Array of steps
-- @usage slider:set_steps({0, 0.2, 0.6, 1})
---@return Slider Slider
@@ -226,7 +223,6 @@ end
-- User can touch any place of node, pin instantly will
-- move at this position and node drag will start.
-- This function require the Defold version 1.3.0+
---@param self Slider Slider
---@param input_node node|string|nil
---@return Slider Slider
function M:set_input_node(input_node)
@@ -236,7 +232,6 @@ end
--- Set Slider input enabled or disabled
---@param self Slider Slider
---@param is_enabled boolean
function M:set_enabled(is_enabled)
self._is_enabled = is_enabled
@@ -244,7 +239,6 @@ end
--- Check if Slider component is enabled
---@param self Slider Slider
---@return boolean
function M:is_enabled()
return self._is_enabled

View File

@@ -160,7 +160,6 @@ end
--- Strict swipe click area. Useful for
-- restrict events outside stencil node
---@param self Swipe Swipe
---@param zone node|string|nil Gui node
function M:set_click_zone(zone)
self.click_zone = self:get_node(zone)

View File

@@ -78,7 +78,6 @@ function M:on_layout_change()
end
---@param self druid.timer
---@param set_to number Value in seconds
---@return druid.timer self
function M:set_to(set_to)
@@ -89,7 +88,6 @@ function M:set_to(set_to)
end
---@param self druid.timer
---@param is_on boolean|nil Timer enable state
---@return druid.timer self
function M:set_state(is_on)
@@ -100,7 +98,6 @@ function M:set_state(is_on)
end
---@param self druid.timer
---@param from number Start time in seconds
---@param to number Target time in seconds
---@return druid.timer self