From 11ae63a9f68d37584ffd71140f97b5fe8363ddce Mon Sep 17 00:00:00 2001 From: Insality Date: Tue, 27 Aug 2024 17:45:09 +0300 Subject: [PATCH] Update annotations --- .luacheckrc | 56 ------------ .vscode/settings.json | 17 ++++ docs/modules/Button.html | 22 ++--- docs/modules/Checkbox.html | 15 ++-- docs/modules/CheckboxGroup.html | 7 +- docs/modules/Drag.html | 12 ++- docs/modules/DruidInstance.html | 44 +++++----- docs/modules/DynamicGrid.html | 2 +- docs/modules/Hotkey.html | 3 +- docs/modules/Hover.html | 2 +- docs/modules/Input.html | 12 +-- docs/modules/LangText.html | 10 +-- docs/modules/PinKnob.html | 9 +- docs/modules/Progress.html | 19 ++-- docs/modules/RadioGroup.html | 9 +- docs/modules/RichText.html | 15 ++-- docs/modules/Scroll.html | 64 ++++++-------- docs/modules/Slider.html | 2 +- docs/modules/StaticGrid.html | 19 ++-- docs/modules/Swipe.html | 17 ++-- docs/modules/Text.html | 19 ++-- druid/annotations.lua | 127 ++++++++++++++------------- druid/base/button.lua | 10 +-- druid/base/drag.lua | 6 +- druid/base/hover.lua | 2 +- druid/base/scroll.lua | 28 +++--- druid/base/static_grid.lua | 6 +- druid/base/text.lua | 6 +- druid/custom/pin_knob/pin_knob.lua | 2 +- druid/custom/rich_text/rich_text.lua | 6 +- druid/extended/checkbox.lua | 6 +- druid/extended/checkbox_group.lua | 2 +- druid/extended/dynamic_grid.lua | 2 +- druid/extended/hotkey.lua | 2 +- druid/extended/input.lua | 8 +- druid/extended/lang_text.lua | 4 +- druid/extended/progress.lua | 6 +- druid/extended/radio_group.lua | 2 +- druid/extended/slider.lua | 2 +- druid/extended/swipe.lua | 8 +- druid/system/druid_instance.lua | 19 ++-- utils/annotations_manual.lua | 2 + 42 files changed, 275 insertions(+), 356 deletions(-) delete mode 100644 .luacheckrc create mode 100644 .vscode/settings.json diff --git a/.luacheckrc b/.luacheckrc deleted file mode 100644 index f9c6bc52..00000000 --- a/.luacheckrc +++ /dev/null @@ -1,56 +0,0 @@ -std = "max" -files['.luacheckrc'].global = false -unused_args = false - -max_code_line_length = 120 -max_comment_line_length = false - -globals = { - "sys", - "go", - "gui", - "label", - "render", - "crash", - "sprite", - "sound", - "tilemap", - "spine", - "particlefx", - "physics", - "factory", - "collectionfactory", - "iac", - "msg", - "vmath", - "url", - "http", - "image", - "json", - "zlib", - "iap", - "push", - "facebook", - "hash", - "hash_to_hex", - "pprint", - "init", - "final", - "update", - "on_input", - "on_message", - "on_reload", - "socket", - "table", - "debug", - "timer", - "window", - "buffer", - "resource", - "defos", - "html5", - "describe", - "before", - "after", - "it", -} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..0f165efc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "Lua.diagnostics.globals": [ + "init", + "final", + "update", + "on_message", + "on_input", + "describe", + "before", + "after", + "it" + ], + "Lua.workspace.ignoreDir": [ + ".vscode", + "test/*" + ] +} \ No newline at end of file diff --git a/docs/modules/Button.html b/docs/modules/Button.html index 0b8a8e9b..a451bac0 100644 --- a/docs/modules/Button.html +++ b/docs/modules/Button.html @@ -360,7 +360,7 @@

Parameters:

Button
  • zone - node or nil + node, string or nil Gui node
  • @@ -508,19 +508,16 @@

    Tables

    Fields:

    @@ -289,9 +287,8 @@

    Fields

    diff --git a/docs/modules/CheckboxGroup.html b/docs/modules/CheckboxGroup.html index 8551324f..3a3914b1 100644 --- a/docs/modules/CheckboxGroup.html +++ b/docs/modules/CheckboxGroup.html @@ -86,7 +86,7 @@

    Functions

    Return checkbox group state - init(self, nodes, callback[, click_nodes=node]) + init(self, nodes, callback, click_nodes) The CheckboxGroup constructor @@ -142,7 +142,7 @@

    Returns:

    - init(self, nodes, callback[, click_nodes=node]) + init(self, nodes, callback, click_nodes)
    The CheckboxGroup constructor @@ -163,9 +163,8 @@

    Parameters:

    Checkbox callback
  • click_nodes - node[] + node[] or nil Array of trigger nodes, by default equals to nodes - (default node)
  • diff --git a/docs/modules/Drag.html b/docs/modules/Drag.html index e9672823..0b7c4c7f 100644 --- a/docs/modules/Drag.html +++ b/docs/modules/Drag.html @@ -253,7 +253,7 @@

    Parameters:

    Drag
  • node - node + node, string or nil Gui node
  • @@ -305,14 +305,12 @@

    Tables

    Fields:

    diff --git a/docs/modules/DruidInstance.html b/docs/modules/DruidInstance.html index 1811027b..71a1df52 100644 --- a/docs/modules/DruidInstance.html +++ b/docs/modules/DruidInstance.html @@ -162,7 +162,7 @@

    Functions

    Create Checkbox component - new_checkbox_group(self, nodes, callback[, click_nodes=node]) + new_checkbox_group(self, nodes, callback, click_nodes) Create CheckboxGroup component @@ -194,7 +194,7 @@

    Functions

    Create LangText component - new_layout(self, node, mode) + new_layout(self, node, mode, on_size_changed_callback) Create Layout component @@ -202,7 +202,7 @@

    Functions

    Create Progress component - new_radio_group(self, nodes, callback[, click_nodes=node]) + new_radio_group(self, nodes, callback, click_nodes) Create RadioGroup component @@ -246,11 +246,11 @@

    Functions

    Remove created component from Druid instance. - set_blacklist(self[, blacklist_components=nil]) + set_blacklist(self, blacklist_components) Set blacklist components for input processing. - set_whitelist(self[, whitelist_components=nil]) + set_whitelist(self, whitelist_components) Set whitelist components for input processing. @@ -415,7 +415,7 @@

    Parameters:

    Button callback params
  • anim_node - node or nil + node, string or nil Button anim node (node, if not provided)
  • @@ -476,7 +476,7 @@

    Returns:

    - new_checkbox_group(self, nodes, callback[, click_nodes=node]) + new_checkbox_group(self, nodes, callback, click_nodes)
    Create CheckboxGroup component @@ -489,7 +489,7 @@

    Parameters:

  • nodes - node[] + (node or string)[] Array of gui node
  • callback @@ -497,9 +497,8 @@

    Parameters:

    Checkbox callback
  • click_nodes - node[] + (node, string)[] or nil Array of trigger nodes, by default equals to nodes - (default node)
  • @@ -712,7 +711,7 @@

    Parameters:

    Button node to enabled input component
  • text_node - string or node + string, node or druid.text Text node what will be changed on user input
  • keyboard_type @@ -773,7 +772,7 @@

    Returns:

  • - new_layout(self, node, mode) + new_layout(self, node, mode, on_size_changed_callback)
    Create Layout component @@ -793,6 +792,10 @@

    Parameters:

    string The layout mode +
  • on_size_changed_callback + function or nil + The callback on window resize +
  • Returns:

    @@ -847,7 +850,7 @@

    Returns:

    - new_radio_group(self, nodes, callback[, click_nodes=node]) + new_radio_group(self, nodes, callback, click_nodes)
    Create RadioGroup component @@ -860,7 +863,7 @@

    Parameters:

  • nodes - node[] + (node or string)[] Array of gui node
  • callback @@ -868,9 +871,8 @@

    Parameters:

    Radio callback
  • click_nodes - node[] + (node, string)[] or nil Array of trigger nodes, by default equals to nodes - (default node)
  • @@ -1249,7 +1251,7 @@

    Parameters:

    - set_blacklist(self[, blacklist_components=nil]) + set_blacklist(self, blacklist_components)
    Set blacklist components for input processing. @@ -1264,9 +1266,8 @@

    Parameters:

    DruidInstance
  • blacklist_components - table or BaseComponent + table, BaseComponent or nil The array of component to blacklist - (default nil)
  • @@ -1283,7 +1284,7 @@

    Returns:

    - set_whitelist(self[, whitelist_components=nil]) + set_whitelist(self, whitelist_components)
    Set whitelist components for input processing. @@ -1298,9 +1299,8 @@

    Parameters:

  • whitelist_components - table or BaseComponent + table, BaseComponent or nil The array of component to whitelist - (default nil)
  • diff --git a/docs/modules/DynamicGrid.html b/docs/modules/DynamicGrid.html index 2f6677fc..52d84583 100644 --- a/docs/modules/DynamicGrid.html +++ b/docs/modules/DynamicGrid.html @@ -420,7 +420,7 @@

    Returns:

      vector3 - Node position + node position
    diff --git a/docs/modules/Hotkey.html b/docs/modules/Hotkey.html index bf191fbd..bb8c0daa 100644 --- a/docs/modules/Hotkey.html +++ b/docs/modules/Hotkey.html @@ -289,9 +289,8 @@

    Fields

    diff --git a/docs/modules/Hover.html b/docs/modules/Hover.html index 16233462..d47a6622 100644 --- a/docs/modules/Hover.html +++ b/docs/modules/Hover.html @@ -259,7 +259,7 @@

    Parameters:

    Hover
  • zone - node + node, string or nil Gui node
  • diff --git a/docs/modules/Input.html b/docs/modules/Input.html index 0434ec0e..b71cc853 100644 --- a/docs/modules/Input.html +++ b/docs/modules/Input.html @@ -422,23 +422,19 @@

    Fields:

    - init(self, node[, locale_id=node_text[, adjust_type=downscale]]) + init(self, node, locale_id, adjust_type)
    The LangText constructor @@ -202,14 +202,12 @@

    Parameters:

    The node_id or gui.get_node(node_id)
  • locale_id - string + string or nil Default locale id or text from node as default - (default node_text)
  • adjust_type - string + string or nil Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference - (default downscale)
  • diff --git a/docs/modules/PinKnob.html b/docs/modules/PinKnob.html index 6e58444d..d97d64e5 100644 --- a/docs/modules/PinKnob.html +++ b/docs/modules/PinKnob.html @@ -91,7 +91,7 @@

    Functions

    Set current and min/max angles for component - set_friction(self[, value=1]) + set_friction(self, value) Set current and min/max angles for component @@ -192,7 +192,7 @@

    Returns:

    - set_friction(self[, value=1]) + set_friction(self, value)
    Set current and min/max angles for component @@ -205,9 +205,8 @@

    Parameters:

    PinKnob
  • value - number - The spin speed multiplier - (default 1) + number or nil + The spin speed multiplier. Default: 1
  • diff --git a/docs/modules/Progress.html b/docs/modules/Progress.html index b72ba4f6..cec89887 100644 --- a/docs/modules/Progress.html +++ b/docs/modules/Progress.html @@ -103,7 +103,7 @@

    Functions

    Return current progress bar value - init(self, node, key[, init_value=1]) + init(self, node, key, init_value) The Progress constructor @@ -234,7 +234,7 @@

    Parameters:

    - init(self, node, key[, init_value=1]) + init(self, node, key, init_value)
    The Progress constructor @@ -255,9 +255,8 @@

    Parameters:

    Progress bar direction: const.SIDE.X or const.SIDE.Y
  • init_value - number - Initial value of progress bar - (default 1) + number or nil + Initial value of progress bar. Default: 1
  • @@ -401,14 +400,12 @@

    Tables

    Fields:

    diff --git a/docs/modules/RadioGroup.html b/docs/modules/RadioGroup.html index 95b3e24e..7445394f 100644 --- a/docs/modules/RadioGroup.html +++ b/docs/modules/RadioGroup.html @@ -86,7 +86,7 @@

    Functions

    Return radio group state - init(self, nodes, callback[, click_nodes=node]) + init(self, nodes, callback, click_nodes) The RadioGroup constructor @@ -142,7 +142,7 @@

    Returns:

    - init(self, nodes, callback[, click_nodes=node]) + init(self, nodes, callback, click_nodes)
    The RadioGroup constructor @@ -163,9 +163,8 @@

    Parameters:

    Radio callback
  • click_nodes - node[] - Array of trigger nodes, by default equals to nodes - (default node) + node[] or nil + Array of trigger nodes, by default equals to nodes. Default - nodes
  • diff --git a/docs/modules/RichText.html b/docs/modules/RichText.html index 372c37e2..990ce514 100644 --- a/docs/modules/RichText.html +++ b/docs/modules/RichText.html @@ -403,19 +403,16 @@

    Tables

    Fields:

    diff --git a/docs/modules/Scroll.html b/docs/modules/Scroll.html index 3cb1facd..6eefd066 100644 --- a/docs/modules/Scroll.html +++ b/docs/modules/Scroll.html @@ -529,7 +529,7 @@

    Parameters:

  • node - node + node or string Gui node
  • @@ -687,7 +687,7 @@

    Parameters:

    The new size for content node
  • offset - vector3 + vector3 or nil Offset value to set, where content is starts
  • @@ -751,64 +751,52 @@

    Tables

    Fields:

    diff --git a/docs/modules/Slider.html b/docs/modules/Slider.html index 3fdf8fe4..bc726439 100644 --- a/docs/modules/Slider.html +++ b/docs/modules/Slider.html @@ -225,7 +225,7 @@

    Parameters:

    Slider
  • input_node - node + node, string or nil
  • diff --git a/docs/modules/StaticGrid.html b/docs/modules/StaticGrid.html index e5591d34..4f2daeed 100644 --- a/docs/modules/StaticGrid.html +++ b/docs/modules/StaticGrid.html @@ -138,7 +138,7 @@

    Functions

    Return grid content size - init(self, parent, element[, in_row=1]) + init(self, parent, element, in_row) The StaticGrid constructor @@ -496,7 +496,7 @@

    Returns:

    - init(self, parent, element[, in_row=1]) + init(self, parent, element, in_row)
    The StaticGrid constructor @@ -517,9 +517,8 @@

    Parameters:

    Element prefab. Need to get it size
  • in_row - number - How many nodes in row can be placed - (default 1) + number or nil + How many nodes in row can be placed. By default 1
  • @@ -672,14 +671,12 @@

    Tables

    Fields:

    diff --git a/docs/modules/Swipe.html b/docs/modules/Swipe.html index 3b68b0da..da20bb1f 100644 --- a/docs/modules/Swipe.html +++ b/docs/modules/Swipe.html @@ -169,7 +169,7 @@

    Parameters:

    Swipe
  • zone - node + node, string or nil Gui node
  • @@ -196,19 +196,16 @@

    Tables

    Fields:

    diff --git a/docs/modules/Text.html b/docs/modules/Text.html index d4db3a6d..eb925ac7 100644 --- a/docs/modules/Text.html +++ b/docs/modules/Text.html @@ -109,7 +109,7 @@

    Functions

    Calculate text width with font with respect to trailing space - init(self, node, value[, adjust_type=downscale]) + init(self, node, value, adjust_type) The Text constructor @@ -284,7 +284,7 @@

    Returns:

    - init(self, node, value[, adjust_type=downscale]) + init(self, node, value, adjust_type)
    The Text constructor @@ -305,9 +305,8 @@

    Parameters:

    Initial text. Default value is node text from GUI scene.
  • adjust_type - string - Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference - (default downscale) + string or nil + Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference. Default: downscale
  • @@ -612,14 +611,12 @@

    Tables

    Fields:

    diff --git a/druid/annotations.lua b/druid/annotations.lua index e6c25f92..7360edaf 100644 --- a/druid/annotations.lua +++ b/druid/annotations.lua @@ -168,7 +168,7 @@ function druid__blocker.set_enabled(self, state) end ---@class druid.button : druid.base_component ----@field anim_node node Button animation node. +---@field anim_node node|nil Button animation node. ---@field click_zone node|nil Additional button click area, defined by another GUI node ---@field hover druid.hover The @{Hover}: Button Hover component ---@field node node Button trigger node @@ -213,7 +213,7 @@ function druid__button.set_check_function(self, check_function, failure_callback --- Set additional button click area. --- Useful to restrict click outside out stencil node or scrollable content. This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check ---@param self druid.button @{Button} ----@param zone node|nil Gui node +---@param zone node|string|nil Gui node ---@return druid.button Current button instance function druid__button.set_click_zone(self, zone) end @@ -239,9 +239,9 @@ function druid__button.set_web_user_interaction(self, is_web_mode) end ---@class druid.button.style ----@field AUTOHOLD_TRIGGER number Maximum hold time to trigger button release while holding ----@field DOUBLETAP_TIME number Time between double taps ----@field LONGTAP_TIME number Minimum time to trigger on_hold_callback +---@field AUTOHOLD_TRIGGER number|nil Maximum hold time to trigger button release while holding. Default: 0.8 +---@field DOUBLETAP_TIME number|nil Time between double taps. Default: 0.4 +---@field LONGTAP_TIME number|nil Minimum time to trigger on_hold_callback. Default: 0.4 ---@field on_click function function(self, node) ---@field on_click_disabled function function(self, node) ---@field on_hover function function(self, node, hover_state) @@ -252,7 +252,7 @@ local druid__button__style = {} ---@class druid.checkbox : druid.base_component ---@field button druid.button Button component from click_node ----@field click_node node Button trigger node +---@field click_node node|nil Button trigger node ---@field node node Visual node ---@field on_change_state druid.event On change state callback(self, state) ---@field style druid.checkbox.style Component style params. @@ -267,8 +267,8 @@ function druid__checkbox.get_state(self) end ---@param self druid.checkbox @{Checkbox} ---@param node node Gui node ---@param callback function Checkbox callback ----@param click_node node Trigger node, by default equals to node ----@param initial_state boolean The initial state of checkbox, default - false +---@param click_node node|nil Trigger node, by default equals to node. Default: node +---@param initial_state boolean|nil The initial state of checkbox, default - false function druid__checkbox.init(self, node, callback, click_node, initial_state) end --- Set checkbox state @@ -298,7 +298,7 @@ function druid__checkbox_group.get_state(self) end ---@param self druid.checkbox_group @{CheckboxGroup} ---@param nodes node[] Array of gui node ---@param callback function Checkbox callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes +---@param click_nodes node[]|nil Array of trigger nodes, by default equals to nodes function druid__checkbox_group.init(self, nodes, callback, click_nodes) end --- Set checkbox group state @@ -412,7 +412,7 @@ function druid__drag.is_enabled(self) end --- Strict drag click area. --- Useful for restrict events outside stencil node ---@param self druid.drag @{Drag} ----@param node node Gui node +---@param node node|string|nil Gui node function druid__drag.set_click_zone(self, node) end --- Set Drag input enabled or disabled @@ -422,8 +422,8 @@ function druid__drag.set_enabled(self, is_enabled) end ---@class druid.drag.style ----@field DRAG_DEADZONE number Distance in pixels to start dragging ----@field NO_USE_SCREEN_KOEF boolean If screen aspect ratio affects on drag values +---@field DRAG_DEADZONE number|nil Distance in pixels to start dragging. Default: 10 +---@field NO_USE_SCREEN_KOEF boolean|nil If screen aspect ratio affects on drag values. Default: false local druid__drag__style = {} @@ -487,7 +487,7 @@ function druid__dynamic_grid.get_offset(self) end ---@param index number The grid element index ---@param node node The node to be placed ---@param origin_index number|nil Index of nearby node ----@return vector3 Node position +---@return vector3 node position function druid__dynamic_grid.get_pos(self, index, node, origin_index) end --- Return grid content size @@ -555,7 +555,7 @@ function druid__event.unsubscribe(self, callback, context) end ---@class druid.hotkey : druid.base_component ---@field button druid.button Button component from click_node ----@field click_node node Button trigger node +---@field click_node node|nil Button trigger node ---@field node node Visual node ---@field on_change_state druid.event On change state callback(self, state) ---@field style druid.hotkey.style Component style params. @@ -618,7 +618,7 @@ function druid__hover.is_mouse_hovered(self) end --- Strict hover click area. --- Useful for no click events outside stencil node ---@param self druid.hover @{Hover} ----@param zone node Gui node +---@param zone node|string|nil Gui node function druid__hover.set_click_zone(self, zone) end --- Set enable state of hover component. @@ -702,10 +702,10 @@ function druid__input.unselect(self) end ---@class druid.input.style ----@field IS_LONGTAP_ERASE boolean Is long tap will erase current input data ----@field IS_UNSELECT_ON_RESELECT boolean If true, call unselect on select selected input ----@field MASK_DEFAULT_CHAR string Default character mask for password input ----@field NO_CONSUME_INPUT_WHILE_SELECTED boolean If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) +---@field IS_LONGTAP_ERASE boolean Is long tap will erase current input data. Default: false +---@field IS_UNSELECT_ON_RESELECT boolean If true, call unselect on select selected input. Default: false +---@field MASK_DEFAULT_CHAR string Default character mask for password input. Default: *] +---@field NO_CONSUME_INPUT_WHILE_SELECTED boolean If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured). Default: false ---@field button_style table Custom button style for input node ---@field on_input_wrong function (self, button_node) Callback on wrong user input ---@field on_select function (self, button_node) Callback on input field selecting @@ -734,8 +734,8 @@ function druid__lang_text.format(self, a, b, c, d, e, f, g) end --- The @{LangText} constructor ---@param self druid.lang_text @{LangText} ---@param node string|node The node_id or gui.get_node(node_id) ----@param locale_id string Default locale id or text from node as default ----@param adjust_type string Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference +---@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 function druid__lang_text.init(self, node, locale_id, adjust_type) end --- Setup raw text to lang_text component @@ -846,7 +846,7 @@ function druid__pin_knob.set_angle(self, cur_value, min, max) end --- Set current and min/max angles for component ---@param self druid.pin_knob @{PinKnob} ----@param value number The spin speed multiplier +---@param value number|nil The spin speed multiplier. Default: 1 ---@return druid.pin_knob @{PinKnob} function druid__pin_knob.set_friction(self, value) end @@ -878,7 +878,7 @@ function druid__progress.get(self) end ---@param self druid.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 Initial value of progress bar +---@param init_value number|nil Initial value of progress bar. Default: 1 function druid__progress.init(self, node, key, init_value) end --- Set progress bar max node size @@ -906,8 +906,8 @@ function druid__progress.to(self, to, callback) end ---@class druid.progress.style ----@field MIN_DELTA number Minimum step to fill progress bar ----@field SPEED number Progress bas fill rate. More -> faster +---@field MIN_DELTA number|nil Minimum step to fill progress bar. Default: 0.005 +---@field SPEED number|nil Progress bas fill rate. More -> faster. Default: 5 local druid__progress__style = {} @@ -925,7 +925,7 @@ function druid__radio_group.get_state(self) end ---@param self druid.radio_group @{RadioGroup} ---@param nodes node[] Array of gui node ---@param callback function Radio callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes +---@param click_nodes node[]|nil Array of trigger nodes, by default equals to nodes. Default - nodes function druid__radio_group.init(self, nodes, callback, click_nodes) end --- Set radio group state @@ -1004,9 +1004,9 @@ function druid__rich_text.tagged(tag) end ---@class druid.rich_text.style ----@field ADJUST_SCALE_DELTA number Scale step on each height adjust step ----@field ADJUST_STEPS number Amount steps of attemps text adjust by height ----@field COLORS table Rich Text color aliases +---@field ADJUST_SCALE_DELTA number|nil Scale step on each height adjust step. Default: 0.02 +---@field ADJUST_STEPS number|nil Amount steps of attemps text adjust by height. Default: 20 +---@field COLORS table|nil Rich Text color aliases. Default: {} local druid__rich_text__style = {} @@ -1084,7 +1084,7 @@ function druid__scroll.scroll_to_percent(self, percent, is_instant) end --- Strict drag scroll area. --- Useful for restrict events outside stencil node ---@param self druid.drag ----@param node node Gui node +---@param node node|string Gui node function druid__scroll.set_click_zone(self, node) end --- Set extra size for scroll stretching. @@ -1118,7 +1118,7 @@ function druid__scroll.set_points(self, points) end --- It will change content gui node size ---@param self druid.scroll @{Scroll} ---@param size vector3 The new size for content node ----@param offset vector3 Offset value to set, where content is starts +---@param offset vector3|nil Offset value to set, where content is starts ---@return druid.scroll Current scroll instance function druid__scroll.set_size(self, size, offset) end @@ -1130,18 +1130,18 @@ function druid__scroll.set_vertical_scroll(self, state) end ---@class druid.scroll.style ----@field ANIM_SPEED number Scroll gui.animation speed for scroll_to function ----@field BACK_SPEED number Scroll back returning lerp speed ----@field EXTRA_STRETCH_SIZE number extra size in pixels outside of scroll (stretch effect) ----@field FRICT number Multiplier for free inertion ----@field FRICT_HOLD number Multiplier for inertion, while touching ----@field INERT_SPEED number Multiplier for inertion speed ----@field INERT_THRESHOLD number Scroll speed to stop inertion ----@field POINTS_DEADZONE number Speed to check points of interests in no_inertion mode ----@field SMALL_CONTENT_SCROLL boolean If true, content node with size less than view node size can be scrolled ----@field WHEEL_SCROLL_BY_INERTION boolean If true, wheel will add inertion to scroll. Direct set position otherwise. ----@field WHEEL_SCROLL_INVERTED boolean If true, invert direction for touchpad and mouse wheel scroll ----@field WHEEL_SCROLL_SPEED boolean The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling +---@field ANIM_SPEED number|nil Scroll gui.animation speed for scroll_to function. Default: 2 +---@field BACK_SPEED number|nil Scroll back returning lerp speed. Default: 35 +---@field EXTRA_STRETCH_SIZE number|nil extra size in pixels outside of scroll (stretch effect). Default: 0 +---@field FRICT number|nil Multiplier for free inertion. Default: 0 +---@field FRICT_HOLD number|nil Multiplier for inertion, while touching. Default: 0 +---@field INERT_SPEED number|nil Multiplier for inertion speed. Default: 30 +---@field INERT_THRESHOLD number|nil Scroll speed to stop inertion. Default: 3 +---@field POINTS_DEADZONE number|nil Speed to check points of interests in no_inertion mode. Default: 20 +---@field SMALL_CONTENT_SCROLL boolean|nil If true, content node with size less than view node size can be scrolled. Default: false +---@field WHEEL_SCROLL_BY_INERTION boolean|nil If true, wheel will add inertion to scroll. Direct set position otherwise.. Default: false +---@field WHEEL_SCROLL_INVERTED boolean|nil If true, invert direction for touchpad and mouse wheel scroll. Default: false +---@field WHEEL_SCROLL_SPEED boolean|nil The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling. Default: 0 local druid__scroll__style = {} @@ -1173,7 +1173,7 @@ function druid__slider.set(self, value, is_silent) end --- Set input zone for slider. --- 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 druid.slider @{Slider} ----@param input_node node +---@param input_node node|string|nil ---@return druid.slider @{Slider} function druid__slider.set_input_node(self, input_node) end @@ -1258,7 +1258,7 @@ function druid__static_grid.get_size(self) end ---@param self druid.static_grid @{StaticGrid} ---@param parent string|node The GUI Node container, where grid's items will be placed ---@param element node Element prefab. Need to get it size ----@param in_row number How many nodes in row can be placed +---@param in_row number|nil How many nodes in row can be placed. By default 1 function druid__static_grid.init(self, parent, element, in_row) end --- Remove the item from the grid. @@ -1291,8 +1291,8 @@ function druid__static_grid.set_position_function(self, callback) end ---@class druid.static_grid.style ----@field IS_ALIGN_LAST_ROW boolean If true, always align last row of the grid as grid pivot sets ----@field IS_DYNAMIC_NODE_POSES boolean If true, always center grid content as grid pivot sets +---@field IS_ALIGN_LAST_ROW boolean|nil If true, always align last row of the grid as grid pivot sets. Default: false +---@field IS_DYNAMIC_NODE_POSES boolean|nil If true, always center grid content as grid pivot sets. Default: false local druid__static_grid__style = {} @@ -1312,14 +1312,14 @@ function druid__swipe.init(self, node, on_swipe_callback) end --- Strict swipe click area. --- Useful for restrict events outside stencil node ---@param self druid.swipe @{Swipe} ----@param zone node Gui node +---@param zone node|string|nil Gui node function druid__swipe.set_click_zone(self, zone) end ---@class druid.swipe.style ----@field SWIPE_THRESHOLD number Minimum distance for swipe trigger ----@field SWIPE_TIME number Maximum time for swipe trigger ----@field SWIPE_TRIGGER_ON_MOVE boolean If true, trigger on swipe moving, not only release action +---@field SWIPE_THRESHOLD number|nil Minimum distance for swipe trigger. Default: 50 +---@field SWIPE_TIME number|nil Maximum time for swipe trigger. Default: 0.4 +---@field SWIPE_TRIGGER_ON_MOVE boolean|nil If true, trigger on swipe moving, not only release action. Default: false local druid__swipe__style = {} @@ -1357,7 +1357,7 @@ function druid__text.get_text_size(self, text) end ---@param self druid.text @{Text} ---@param node string|node Node name or GUI Text Node itself ---@param value string|nil Initial text. Default value is node text from GUI scene. ----@param adjust_type string Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference +---@param adjust_type string|nil Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference. Default: downscale function druid__text.init(self, node, value, adjust_type) end --- Return true, if text with line break @@ -1417,8 +1417,8 @@ function druid__text.set_to(self, set_to) end ---@class druid.text.style ----@field DEFAULT_ADJUST string The default adjust type for any text component ----@field TRIM_POSTFIX string The postfix for TRIM adjust type +---@field DEFAULT_ADJUST string|nil The default adjust type for any text component. Default: DOWNSCALE +---@field TRIM_POSTFIX string|nil The postfix for TRIM adjust type. Default: ... local druid__text__style = {} @@ -1489,7 +1489,7 @@ function druid_instance.new_blocker(self, node) end ---@param node string|node The node_id or gui.get_node(node_id) ---@param callback function|nil Button callback ---@param params table|nil Button callback params ----@param anim_node node|nil Button anim node (node, if not provided) +---@param anim_node node|string|nil Button anim node (node, if not provided) ---@return druid.button @{Button} component function druid_instance.new_button(self, node, callback, params, anim_node) end @@ -1504,9 +1504,9 @@ function druid_instance.new_checkbox(self, node, callback, click_node, initial_s --- Create @{CheckboxGroup} component ---@param self druid_instance ----@param nodes node[] Array of gui node +---@param nodes (node|string)[] Array of gui node ---@param callback function Checkbox callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes +---@param click_nodes (node|string)[]|nil Array of trigger nodes, by default equals to nodes ---@return druid.checkbox_group @{CheckboxGroup} component function druid_instance.new_checkbox_group(self, nodes, callback, click_nodes) end @@ -1549,7 +1549,7 @@ function druid_instance.new_hover(self, node, on_hover_callback) end --- Create @{Input} component ---@param self druid_instance ---@param click_node string|node Button node to enabled input component ----@param text_node string|node Text node what will be changed on user input +---@param text_node string|node|druid.text Text node what will be changed on user input ---@param keyboard_type number|nil Gui keyboard type for input field ---@return druid.input @{Input} component function druid_instance.new_input(self, click_node, text_node, keyboard_type) end @@ -1566,8 +1566,9 @@ function druid_instance.new_lang_text(self, node, locale_id, adjust_type) end ---@param self druid_instance ---@param node string|node The_node id or gui.get_node(node_id). ---@param mode string The layout mode +---@param on_size_changed_callback function|nil The callback on window resize ---@return druid.layout @{Layout} component -function druid_instance.new_layout(self, node, mode) end +function druid_instance.new_layout(self, node, mode, on_size_changed_callback) end --- Create @{Progress} component ---@param self druid_instance @@ -1579,9 +1580,9 @@ function druid_instance.new_progress(self, node, key, init_value) end --- Create @{RadioGroup} component ---@param self druid_instance ----@param nodes node[] Array of gui node +---@param nodes (node|string)[] Array of gui node ---@param callback function Radio callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes +---@param click_nodes (node|string)[]|nil Array of trigger nodes, by default equals to nodes ---@return druid.radio_group @{RadioGroup} component function druid_instance.new_radio_group(self, nodes, callback, click_nodes) end @@ -1665,14 +1666,14 @@ function druid_instance.remove(self, component) end --- Set blacklist components for input processing. --- If blacklist is not empty and component contains in this list, component will be not processed on input step ---@param self druid_instance @{DruidInstance} ----@param blacklist_components table|druid.base_component The array of component to blacklist +---@param blacklist_components table|druid.base_component|nil The array of component to blacklist ---@return self @{DruidInstance} function druid_instance.set_blacklist(self, blacklist_components) end --- Set whitelist components for input processing. --- If whitelist is not empty and component not contains in this list, component will be not processed on input step ---@param self druid_instance ----@param whitelist_components table|druid.base_component The array of component to whitelist +---@param whitelist_components table|druid.base_component|nil The array of component to whitelist ---@return self @{DruidInstance} function druid_instance.set_whitelist(self, whitelist_components) end diff --git a/druid/base/button.lua b/druid/base/button.lua index 5bd10c4e..73c58a6f 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -123,7 +123,7 @@ -- In default case equals to clickable node. -- -- Usecase: You have the big clickable panel, but want to animate only one small icon on it. --- @tfield[opt=node] node anim_node +-- @tfield node|nil anim_node Default node ---Custom args for any Button event. Setup in Button constructor -- @tfield any params @@ -258,9 +258,9 @@ end -- You can override this component styles params in Druid styles table -- or create your own style -- @table style --- @tfield[opt=0.4] number LONGTAP_TIME Minimum time to trigger on_hold_callback --- @tfield[opt=0.8] number AUTOHOLD_TRIGGER Maximum hold time to trigger button release while holding --- @tfield[opt=0.4] number DOUBLETAP_TIME Time between double taps +-- @tfield number|nil LONGTAP_TIME Minimum time to trigger on_hold_callback. Default: 0.4 +-- @tfield number|nil AUTOHOLD_TRIGGER Maximum hold time to trigger button release while holding. Default: 0.8 +-- @tfield number|nil DOUBLETAP_TIME Time between double taps. Default: 0.4 -- @tfield function on_click function(self, node) -- @tfield function on_click_disabled function(self, node) -- @tfield function on_hover function(self, node, hover_state) @@ -478,7 +478,7 @@ end -- -- This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check -- @tparam Button self @{Button} --- @tparam node|nil zone Gui node +-- @tparam node|string|nil zone Gui node -- @treturn Button Current button instance -- @usage -- button:set_click_zone("stencil_node") diff --git a/druid/base/drag.lua b/druid/base/drag.lua index c2a5072f..3cae2b9e 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -175,8 +175,8 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=10] number DRAG_DEADZONE Distance in pixels to start dragging --- @tfield[opt=false] boolean NO_USE_SCREEN_KOEF If screen aspect ratio affects on drag values +-- @tfield number|nil DRAG_DEADZONE Distance in pixels to start dragging. Default: 10 +-- @tfield boolean|nil NO_USE_SCREEN_KOEF If screen aspect ratio affects on drag values. Default: false function Drag.on_style_change(self, style) self.style = {} self.style.DRAG_DEADZONE = style.DRAG_DEADZONE or 10 @@ -324,7 +324,7 @@ end --- Strict drag click area. Useful for -- restrict events outside stencil node -- @tparam Drag self @{Drag} --- @tparam node node Gui node +-- @tparam node|string|nil node Gui node function Drag.set_click_zone(self, node) self.click_zone = self:get_node(node) end diff --git a/druid/base/hover.lua b/druid/base/hover.lua index f2a25175..607181f9 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -128,7 +128,7 @@ end --- Strict hover click area. Useful for -- no click events outside stencil node -- @tparam Hover self @{Hover} --- @tparam node zone Gui node +-- @tparam node|string|nil zone Gui node function Hover.set_click_zone(self, zone) self.click_zone = self:get_node(zone) end diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 73284299..c75956c6 100755 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -123,18 +123,18 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=0] number FRICT Multiplier for free inertion --- @tfield[opt=0] number FRICT_HOLD Multiplier for inertion, while touching --- @tfield[opt=3] number INERT_THRESHOLD Scroll speed to stop inertion --- @tfield[opt=30] number INERT_SPEED Multiplier for inertion speed --- @tfield[opt=20] number POINTS_DEADZONE Speed to check points of interests in no_inertion mode --- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed --- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function --- @tfield[opt=0] number EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect) --- @tfield[opt=false] boolean SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled --- @tfield[opt=0] boolean WHEEL_SCROLL_SPEED The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling --- @tfield[opt=false] boolean WHEEL_SCROLL_INVERTED If true, invert direction for touchpad and mouse wheel scroll --- @tfield[opt=false] boolean WHEEL_SCROLL_BY_INERTION If true, wheel will add inertion to scroll. Direct set position otherwise. +-- @tfield number|nil FRICT Multiplier for free inertion. Default: 0 +-- @tfield number|nil FRICT_HOLD Multiplier for inertion, while touching. Default: 0 +-- @tfield number|nil INERT_THRESHOLD Scroll speed to stop inertion. Default: 3 +-- @tfield number|nil INERT_SPEED Multiplier for inertion speed. Default: 30 +-- @tfield number|nil POINTS_DEADZONE Speed to check points of interests in no_inertion mode. Default: 20 +-- @tfield number|nil BACK_SPEED Scroll back returning lerp speed. Default: 35 +-- @tfield number|nil ANIM_SPEED Scroll gui.animation speed for scroll_to function. Default: 2 +-- @tfield number|nil EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect). Default: 0 +-- @tfield boolean|nil SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled. Default: false +-- @tfield boolean|nil WHEEL_SCROLL_SPEED The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling. Default: 0 +-- @tfield boolean|nil WHEEL_SCROLL_INVERTED If true, invert direction for touchpad and mouse wheel scroll. Default: false +-- @tfield boolean|nil WHEEL_SCROLL_BY_INERTION If true, wheel will add inertion to scroll. Direct set position otherwise.. Default: false function Scroll.on_style_change(self, style) self.style = {} self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0 @@ -325,7 +325,7 @@ end -- It will change content gui node size -- @tparam Scroll self @{Scroll} -- @tparam vector3 size The new size for content node --- @tparam vector3 offset Offset value to set, where content is starts +-- @tparam vector3|nil offset Offset value to set, where content is starts -- @treturn druid.scroll Current scroll instance function Scroll.set_size(self, size, offset) if offset then @@ -493,7 +493,7 @@ end --- Strict drag scroll area. Useful for -- restrict events outside stencil node -- @tparam Drag self --- @tparam node node Gui node +-- @tparam node|string node Gui node function Scroll.set_click_zone(self, node) self.drag:set_click_zone(node) end diff --git a/druid/base/static_grid.lua b/druid/base/static_grid.lua index ee2903ec..bfa48ad9 100644 --- a/druid/base/static_grid.lua +++ b/druid/base/static_grid.lua @@ -102,8 +102,8 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=false] boolean IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets --- @tfield[opt=false] boolean IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets +-- @tfield boolean|nil IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets. Default: false +-- @tfield boolean|nil IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets. Default: false function StaticGrid.on_style_change(self, style) self.style = {} self.style.IS_DYNAMIC_NODE_POSES = style.IS_DYNAMIC_NODE_POSES or false @@ -115,7 +115,7 @@ end -- @tparam StaticGrid self @{StaticGrid} -- @tparam string|node parent The GUI Node container, where grid's items will be placed -- @tparam node element Element prefab. Need to get it size --- @tparam[opt=1] number in_row How many nodes in row can be placed +-- @tparam number|nil in_row How many nodes in row can be placed. By default 1 function StaticGrid.init(self, parent, element, in_row) self.parent = self:get_node(parent) self.nodes = {} diff --git a/druid/base/text.lua b/druid/base/text.lua index a34ffe77..28d3ed9b 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -216,8 +216,8 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=...] string TRIM_POSTFIX The postfix for TRIM adjust type --- @tfield[opt=DOWNSCALE] string DEFAULT_ADJUST The default adjust type for any text component +-- @tfield string|nil TRIM_POSTFIX The postfix for TRIM adjust type. Default: ... +-- @tfield string|nil DEFAULT_ADJUST The default adjust type for any text component. Default: DOWNSCALE function Text.on_style_change(self, style) self.style = {} self.style.TRIM_POSTFIX = style.TRIM_POSTFIX or "..." @@ -229,7 +229,7 @@ end -- @tparam Text self @{Text} -- @tparam string|node node Node name or GUI Text Node itself -- @tparam string|nil value Initial text. Default value is node text from GUI scene. --- @tparam[opt=downscale] string adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference +-- @tparam string|nil adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference. Default: downscale function Text.init(self, node, value, adjust_type) self.node = self:get_node(node) self.pos = gui.get_position(self.node) diff --git a/druid/custom/pin_knob/pin_knob.lua b/druid/custom/pin_knob/pin_knob.lua index 418f6bef..868d4a34 100644 --- a/druid/custom/pin_knob/pin_knob.lua +++ b/druid/custom/pin_knob/pin_knob.lua @@ -87,7 +87,7 @@ end --- Set current and min/max angles for component -- @tparam PinKnob self @{PinKnob} --- @tparam[opt=1] number value The spin speed multiplier +-- @tparam number|nil value The spin speed multiplier. Default: 1 -- @treturn PinKnob @{PinKnob} function PinKnob.set_friction(self, value) self._friction = value or 1 diff --git a/druid/custom/rich_text/rich_text.lua b/druid/custom/rich_text/rich_text.lua index 6f0b0cd6..8b542db9 100644 --- a/druid/custom/rich_text/rich_text.lua +++ b/druid/custom/rich_text/rich_text.lua @@ -138,9 +138,9 @@ end -- You can override this component styles params in Druid styles table -- or create your own style -- @table style --- @tfield[opt={}] table COLORS Rich Text color aliases --- @tfield[opt=20] number ADJUST_STEPS Amount steps of attemps text adjust by height --- @tfield[opt=0.02] number ADJUST_SCALE_DELTA Scale step on each height adjust step +-- @tfield table|nil COLORS Rich Text color aliases. Default: {} +-- @tfield number|nil ADJUST_STEPS Amount steps of attemps text adjust by height. Default: 20 +-- @tfield number|nil ADJUST_SCALE_DELTA Scale step on each height adjust step. Default: 0.02 function RichText.on_style_change(self, style) self.style = {} self.style.COLORS = style.COLORS or {} diff --git a/druid/extended/checkbox.lua b/druid/extended/checkbox.lua index 2c629e88..dd139219 100755 --- a/druid/extended/checkbox.lua +++ b/druid/extended/checkbox.lua @@ -14,7 +14,7 @@ -- @tfield node node --- Button trigger node --- @tfield[opt=node] node click_node +-- @tfield node|nil click_node --- Button component from click_node -- @tfield Button button @{Button} @@ -50,8 +50,8 @@ end -- @tparam Checkbox self @{Checkbox} -- @tparam node node Gui node -- @tparam function callback Checkbox callback --- @tparam[opt=node] node click_node Trigger node, by default equals to node --- @tparam[opt=false] boolean initial_state The initial state of checkbox, default - false +-- @tparam node|nil click_node Trigger node, by default equals to node. Default: node +-- @tparam boolean|nil initial_state The initial state of checkbox, default - false function Checkbox.init(self, node, callback, click_node, initial_state) self.druid = self:get_druid() self.node = self:get_node(node) diff --git a/druid/extended/checkbox_group.lua b/druid/extended/checkbox_group.lua index 2dd66ba9..d59adc31 100644 --- a/druid/extended/checkbox_group.lua +++ b/druid/extended/checkbox_group.lua @@ -25,7 +25,7 @@ local CheckboxGroup = component.create("checkbox_group") -- @tparam CheckboxGroup self @{CheckboxGroup} -- @tparam node[] nodes Array of gui node -- @tparam function callback Checkbox callback --- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes +-- @tparam node[]|nil click_nodes Array of trigger nodes, by default equals to nodes function CheckboxGroup.init(self, nodes, callback, click_nodes) self.druid = self:get_druid() self.checkboxes = {} diff --git a/druid/extended/dynamic_grid.lua b/druid/extended/dynamic_grid.lua index 8a91af84..c4f0c765 100644 --- a/druid/extended/dynamic_grid.lua +++ b/druid/extended/dynamic_grid.lua @@ -101,7 +101,7 @@ end -- @tparam number index The grid element index -- @tparam node node The node to be placed -- @tparam number|nil origin_index Index of nearby node --- @treturn vector3 Node position +-- @treturn vector3 node position function DynamicGrid.get_pos(self, index, node, origin_index) local origin_node = self.nodes[origin_index] diff --git a/druid/extended/hotkey.lua b/druid/extended/hotkey.lua index 1e867a86..00765384 100644 --- a/druid/extended/hotkey.lua +++ b/druid/extended/hotkey.lua @@ -14,7 +14,7 @@ -- @tfield node node --- Button trigger node --- @tfield[opt=node] node click_node +-- @tfield node|nil click_node --- Button component from click_node -- @tfield Button button @{Button} diff --git a/druid/extended/input.lua b/druid/extended/input.lua index bed0a929..4426da9e 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -87,10 +87,10 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=false] boolean IS_LONGTAP_ERASE Is long tap will erase current input data --- @tfield[opt=*] string MASK_DEFAULT_CHAR Default character mask for password input --- @tfield[opt=false] boolean IS_UNSELECT_ON_RESELECT If true, call unselect on select selected input --- @tfield[opt=false] boolean NO_CONSUME_INPUT_WHILE_SELECTED If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) +-- @tfield boolean IS_LONGTAP_ERASE Is long tap will erase current input data. Default: false +-- @tfield string MASK_DEFAULT_CHAR Default character mask for password input. Default: *] +-- @tfield boolean IS_UNSELECT_ON_RESELECT If true, call unselect on select selected input. Default: false +-- @tfield boolean NO_CONSUME_INPUT_WHILE_SELECTED If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured). Default: false -- @tfield function on_select (self, button_node) Callback on input field selecting -- @tfield function on_unselect (self, button_node) Callback on input field unselecting -- @tfield function on_input_wrong (self, button_node) Callback on wrong user input diff --git a/druid/extended/lang_text.lua b/druid/extended/lang_text.lua index 6e2a6994..6d38f838 100755 --- a/druid/extended/lang_text.lua +++ b/druid/extended/lang_text.lua @@ -38,8 +38,8 @@ local LangText = component.create("lang_text") --- The @{LangText} constructor -- @tparam LangText self @{LangText} -- @tparam string|node node The node_id or gui.get_node(node_id) --- @tparam[opt=node_text] string locale_id Default locale id or text from node as default --- @tparam[opt=downscale] string adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference +-- @tparam string|nil locale_id Default locale id or text from node as default +-- @tparam string|nil adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference function LangText.init(self, node, locale_id, adjust_type) self.druid = self:get_druid() self.text = self.druid:new_text(node, locale_id, adjust_type) diff --git a/druid/extended/progress.lua b/druid/extended/progress.lua index b5fb749e..2689057d 100644 --- a/druid/extended/progress.lua +++ b/druid/extended/progress.lua @@ -101,8 +101,8 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=5] number SPEED Progress bas fill rate. More -> faster --- @tfield[opt=0.005] number MIN_DELTA Minimum step to fill progress bar +-- @tfield number|nil SPEED Progress bas fill rate. More -> faster. Default: 5 +-- @tfield number|nil MIN_DELTA Minimum step to fill progress bar. Default: 0.005 function Progress.on_style_change(self, style) self.style = {} self.style.SPEED = style.SPEED or 5 @@ -114,7 +114,7 @@ end -- @tparam Progress self @{Progress} -- @tparam string|node node Node name or GUI Node itself. -- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y --- @tparam[opt=1] number init_value Initial value of progress bar +-- @tparam number|nil init_value Initial value of progress bar. Default: 1 function Progress.init(self, node, key, init_value) assert(key == const.SIDE.X or const.SIDE.Y, "Progress bar key should be 'x' or 'y'") diff --git a/druid/extended/radio_group.lua b/druid/extended/radio_group.lua index 8321c3f2..51dbe6b4 100644 --- a/druid/extended/radio_group.lua +++ b/druid/extended/radio_group.lua @@ -34,7 +34,7 @@ end -- @tparam RadioGroup self @{RadioGroup} -- @tparam node[] nodes Array of gui node -- @tparam function callback Radio callback --- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes +-- @tparam node[]|nil click_nodes Array of trigger nodes, by default equals to nodes. Default - nodes function RadioGroup.init(self, nodes, callback, click_nodes) self.druid = self:get_druid() self.checkboxes = {} diff --git a/druid/extended/slider.lua b/druid/extended/slider.lua index 05e9453d..37c4ab72 100644 --- a/druid/extended/slider.lua +++ b/druid/extended/slider.lua @@ -202,7 +202,7 @@ end -- move at this position and node drag will start. -- This function require the Defold version 1.3.0+ -- @tparam Slider self @{Slider} --- @tparam node input_node +-- @tparam node|string|nil input_node -- @treturn Slider @{Slider} function Slider.set_input_node(self, input_node) self._input_node = self:get_node(input_node) diff --git a/druid/extended/swipe.lua b/druid/extended/swipe.lua index 264805b7..110d9f40 100644 --- a/druid/extended/swipe.lua +++ b/druid/extended/swipe.lua @@ -74,9 +74,9 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=0.4] number SWIPE_TIME Maximum time for swipe trigger --- @tfield[opt=50] number SWIPE_THRESHOLD Minimum distance for swipe trigger --- @tfield[opt=false] boolean SWIPE_TRIGGER_ON_MOVE If true, trigger on swipe moving, not only release action +-- @tfield number|nil SWIPE_TIME Maximum time for swipe trigger. Default: 0.4 +-- @tfield number|nil SWIPE_THRESHOLD Minimum distance for swipe trigger. Default: 50 +-- @tfield boolean|nil SWIPE_TRIGGER_ON_MOVE If true, trigger on swipe moving, not only release action. Default: false function Swipe.on_style_change(self, style) self.style = {} self.style.SWIPE_TIME = style.SWIPE_TIME or 0.4 @@ -150,7 +150,7 @@ end --- Strict swipe click area. Useful for -- restrict events outside stencil node -- @tparam Swipe self @{Swipe} --- @tparam node zone Gui node +-- @tparam node|string|nil zone Gui node function Swipe.set_click_zone(self, zone) self.click_zone = self:get_node(zone) end diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 02f875dc..15ad41b7 100755 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -473,7 +473,7 @@ end -- If whitelist is not empty and component not contains in this list, -- component will be not processed on input step -- @tparam DruidInstance self --- @tparam[opt=nil] table|BaseComponent whitelist_components The array of component to whitelist +-- @tparam table|BaseComponent|nil whitelist_components The array of component to whitelist -- @treturn self @{DruidInstance} function DruidInstance.set_whitelist(self, whitelist_components) if whitelist_components and whitelist_components.isInstanceOf then @@ -495,7 +495,7 @@ end -- If blacklist is not empty and component contains in this list, -- component will be not processed on input step -- @tparam DruidInstance self @{DruidInstance} --- @tparam[opt=nil] table|BaseComponent blacklist_components The array of component to blacklist +-- @tparam table|BaseComponent|nil blacklist_components The array of component to blacklist -- @treturn self @{DruidInstance} function DruidInstance.set_blacklist(self, blacklist_components) if blacklist_components and blacklist_components.isInstanceOf then @@ -557,7 +557,7 @@ end -- @tparam string|node node The node_id or gui.get_node(node_id) -- @tparam function|nil callback Button callback -- @tparam table|nil params Button callback params --- @tparam node|nil anim_node Button anim node (node, if not provided) +-- @tparam node|string|nil anim_node Button anim node (node, if not provided) -- @treturn Button @{Button} component function DruidInstance.new_button(self, node, callback, params, anim_node) return DruidInstance.new(self, button, node, callback, params, anim_node) @@ -705,7 +705,7 @@ end --- Create @{Input} component -- @tparam DruidInstance self -- @tparam string|node click_node Button node to enabled input component --- @tparam string|node text_node Text node what will be changed on user input +-- @tparam string|node|druid.text text_node Text node what will be changed on user input -- @tparam number|nil keyboard_type Gui keyboard type for input field -- @treturn Input @{Input} component function DruidInstance.new_input(self, click_node, text_node, keyboard_type) @@ -715,9 +715,9 @@ end --- Create @{CheckboxGroup} component -- @tparam DruidInstance self --- @tparam node[] nodes Array of gui node +-- @tparam (node|string)[] nodes Array of gui node -- @tparam function callback Checkbox callback --- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes +-- @tparam (node|string)[]|nil click_nodes Array of trigger nodes, by default equals to nodes -- @treturn CheckboxGroup @{CheckboxGroup} component function DruidInstance.new_checkbox_group(self, nodes, callback, click_nodes) return helper.require_component_message("checkbox_group") @@ -737,9 +737,9 @@ end --- Create @{RadioGroup} component -- @tparam DruidInstance self --- @tparam node[] nodes Array of gui node +-- @tparam (node|string)[] nodes Array of gui node -- @tparam function callback Radio callback --- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes +-- @tparam (node|string)[]|nil click_nodes Array of trigger nodes, by default equals to nodes -- @treturn RadioGroup @{RadioGroup} component function DruidInstance.new_radio_group(self, nodes, callback, click_nodes) return helper.require_component_message("radio_group") @@ -773,8 +773,9 @@ end -- @tparam DruidInstance self -- @tparam string|node node The_node id or gui.get_node(node_id). -- @tparam string mode The layout mode +-- @tparam function|nil on_size_changed_callback The callback on window resize -- @treturn Layout @{Layout} component -function DruidInstance.new_layout(self, node, mode) +function DruidInstance.new_layout(self, node, mode, on_size_changed_callback) return helper.require_component_message("layout") end diff --git a/utils/annotations_manual.lua b/utils/annotations_manual.lua index d87b665d..7b637bfe 100644 --- a/utils/annotations_manual.lua +++ b/utils/annotations_manual.lua @@ -1,3 +1,5 @@ +---@diagnostic disable: duplicate-doc-field + -- Manual Annotations -- ---@class druid.rich_text.metrics