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

@ -35,7 +35,6 @@ local M = component.create("hover")
--- The Hover constructor --- The Hover constructor
---@param self Hover Hover
---@param node node Gui node ---@param node node Gui node
---@param on_hover_callback function Hover callback ---@param on_hover_callback function Hover callback
---@param on_mouse_hover function On mouse hover callback ---@param on_mouse_hover function On mouse hover callback
@ -115,7 +114,6 @@ end
--- Set hover state --- Set hover state
---@param self Hover Hover
---@param state boolean|nil The hover state ---@param state boolean|nil The hover state
function M:set_hover(state) function M:set_hover(state)
if self._is_hovered == state then if self._is_hovered == state then
@ -132,7 +130,6 @@ end
--- Return current hover state. True if touch action was on the node at current time --- Return current hover state. True if touch action was on the node at current time
---@param self Hover Hover
---@return boolean The current hovered state ---@return boolean The current hovered state
function M:is_hovered() function M:is_hovered()
return self._is_hovered return self._is_hovered
@ -140,7 +137,6 @@ end
--- Set mouse hover state --- Set mouse hover state
---@param self Hover Hover
---@param state boolean|nil The mouse hover state ---@param state boolean|nil The mouse hover state
function M:set_mouse_hover(state) function M:set_mouse_hover(state)
if self._is_mouse_hovered == state then if self._is_mouse_hovered == state then
@ -157,7 +153,6 @@ end
--- Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time --- Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time
---@param self Hover Hover
---@return boolean The current hovered state ---@return boolean The current hovered state
function M:is_mouse_hovered() function M:is_mouse_hovered()
return self._is_mouse_hovered return self._is_mouse_hovered
@ -166,7 +161,6 @@ end
--- Strict hover click area. Useful for --- Strict hover click area. Useful for
-- no click events outside stencil node -- no click events outside stencil node
---@param self Hover Hover
---@param zone node|string|nil Gui node ---@param zone node|string|nil Gui node
function M:set_click_zone(zone) function M:set_click_zone(zone)
self.click_zone = self:get_node(zone) self.click_zone = self:get_node(zone)
@ -176,7 +170,6 @@ end
--- Set enable state of hover component. --- Set enable state of hover component.
-- If hover is not enabled, it will not generate -- If hover is not enabled, it will not generate
-- any hover events -- any hover events
---@param self Hover Hover
---@param state boolean|nil The hover enabled state ---@param state boolean|nil The hover enabled state
function M:set_enabled(state) function M:set_enabled(state)
self._is_enabled = state self._is_enabled = state
@ -193,7 +186,6 @@ end
--- Return current hover enabled state --- Return current hover enabled state
---@param self Hover Hover
---@return boolean The hover enabled state ---@return boolean The hover enabled state
function M:is_enabled() function M:is_enabled()
return self._is_enabled return self._is_enabled

View File

@ -171,7 +171,6 @@ end
--- The Scroll constructor --- The Scroll constructor
---@param self Scroll Scroll
---@param view_node string|node GUI view scroll node ---@param view_node string|node GUI view scroll node
---@param content_node string|node GUI content scroll node ---@param content_node string|node GUI content scroll node
function M:init(view_node, content_node) function M:init(view_node, content_node)
@ -253,7 +252,6 @@ end
--- Start scroll to target point. --- Start scroll to target point.
---@param self Scroll Scroll
---@param point vector3 Target point ---@param point vector3 Target point
---@param is_instant boolean|nil Instant scroll flag ---@param is_instant boolean|nil Instant scroll flag
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0)) -- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
@ -287,7 +285,6 @@ end
--- Scroll to item in scroll by point index. --- Scroll to item in scroll by point index.
---@param self Scroll Scroll
---@param index number Point index ---@param index number Point index
---@param skip_cb boolean|nil If true, skip the point callback ---@param skip_cb boolean|nil If true, skip the point callback
function M:scroll_to_index(index, skip_cb) function M:scroll_to_index(index, skip_cb)
@ -310,7 +307,6 @@ end
--- Start scroll to target scroll percent --- Start scroll to target scroll percent
---@param self Scroll Scroll
---@param percent vector3 target percent ---@param percent vector3 target percent
---@param is_instant boolean|nil instant scroll flag ---@param is_instant boolean|nil instant scroll flag
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0)) -- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
@ -336,7 +332,6 @@ end
--- Return current scroll progress status. --- Return current scroll progress status.
-- Values will be in [0..1] interval -- Values will be in [0..1] interval
---@param self Scroll Scroll
---@return vector3 New vector with scroll progress values ---@return vector3 New vector with scroll progress values
function M:get_percent() function M:get_percent()
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x) local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
@ -348,7 +343,6 @@ end
--- Set scroll content size. --- Set scroll content size.
-- It will change content gui node size -- It will change content gui node size
---@param self Scroll Scroll
---@param size vector3 The new size for content node ---@param size vector3 The new size for content node
---@param offset vector3|nil 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 ---@return druid.scroll Current scroll instance
@ -364,7 +358,6 @@ end
--- Set new scroll view size in case the node size was changed. --- Set new scroll view size in case the node size was changed.
---@param self Scroll Scroll
---@param size vector3 The new size for view node ---@param size vector3 The new size for view node
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:set_view_size(size) function M:set_view_size(size)
@ -378,7 +371,6 @@ end
--- Refresh scroll view size --- Refresh scroll view size
---@param self Scroll Scroll
function M:update_view_size() function M:update_view_size()
self.view_size = helper.get_scaled_size(self.view_node) self.view_size = helper.get_scaled_size(self.view_node)
self.view_border = helper.get_border(self.view_node) self.view_border = helper.get_border(self.view_node)
@ -391,7 +383,6 @@ end
--- Enable or disable scroll inert. --- Enable or disable scroll inert.
-- If disabled, scroll through points (if exist) -- If disabled, scroll through points (if exist)
-- If no points, just simple drag without inertion -- If no points, just simple drag without inertion
---@param self Scroll Scroll
---@param state boolean|nil Inert scroll state ---@param state boolean|nil Inert scroll state
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:set_inert(state) function M:set_inert(state)
@ -402,7 +393,6 @@ end
--- Return if scroll have inertion. --- Return if scroll have inertion.
---@param self Scroll Scroll
---@return boolean @If scroll have inertion ---@return boolean @If scroll have inertion
function M:is_inert() function M:is_inert()
return self._is_inert return self._is_inert
@ -411,7 +401,6 @@ end
--- Set extra size for scroll stretching. --- Set extra size for scroll stretching.
-- Set 0 to disable stretching effect -- Set 0 to disable stretching effect
---@param self Scroll Scroll
---@param stretch_size number|nil Size in pixels of additional scroll area ---@param stretch_size number|nil Size in pixels of additional scroll area
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:set_extra_stretch_size(stretch_size) function M:set_extra_stretch_size(stretch_size)
@ -423,7 +412,6 @@ end
--- Return vector of scroll size with width and height. --- Return vector of scroll size with width and height.
---@param self Scroll Scroll
---@return vector3 Available scroll size ---@return vector3 Available scroll size
function M:get_scroll_size() function M:get_scroll_size()
return self.available_size return self.available_size
@ -432,7 +420,6 @@ end
--- Set points of interest. --- Set points of interest.
-- Scroll will always centered on closer points -- Scroll will always centered on closer points
---@param self Scroll Scroll
---@param points table Array of vector3 points ---@param points table Array of vector3 points
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:set_points(points) function M:set_points(points)
@ -449,7 +436,6 @@ end
--- Lock or unlock horizontal scroll --- Lock or unlock horizontal scroll
---@param self Scroll Scroll
---@param state boolean|nil True, if horizontal scroll is enabled ---@param state boolean|nil True, if horizontal scroll is enabled
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:set_horizontal_scroll(state) function M:set_horizontal_scroll(state)
@ -460,7 +446,6 @@ end
--- Lock or unlock vertical scroll --- Lock or unlock vertical scroll
---@param self Scroll Scroll
---@param state boolean|nil True, if vertical scroll is enabled ---@param state boolean|nil True, if vertical scroll is enabled
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:set_vertical_scroll(state) function M:set_vertical_scroll(state)
@ -472,7 +457,6 @@ end
--- Check node if it visible now on scroll. --- Check node if it visible now on scroll.
-- Extra border is not affected. Return true for elements in extra scroll zone -- Extra border is not affected. Return true for elements in extra scroll zone
---@param self Scroll Scroll
---@param node node The node to check ---@param node node The node to check
---@return boolean True if node in visible scroll area ---@return boolean True if node in visible scroll area
function M:is_node_in_view(node) function M:is_node_in_view(node)
@ -513,8 +497,7 @@ end
--- Bind the grid component (Static or Dynamic) to recalculate --- Bind the grid component (Static or Dynamic) to recalculate
-- scroll size on grid changes -- scroll size on grid changes
---@param self Scroll Scroll ---@param grid druid.grid Druid grid component
---@param grid StaticGrid Druid grid component
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function M:bind_grid(grid) function M:bind_grid(grid)
if self._grid_on_change then if self._grid_on_change then
@ -542,7 +525,6 @@ end
--- Strict drag scroll area. Useful for --- Strict drag scroll area. Useful for
-- restrict events outside stencil node -- restrict events outside stencil node
---@param self Drag
---@param node node|string Gui node ---@param node node|string Gui node
function M:set_click_zone(node) function M:set_click_zone(node)
self.drag:set_click_zone(node) self.drag:set_click_zone(node)

View File

@ -128,7 +128,6 @@ end
--- The StaticGrid constructor --- The StaticGrid constructor
---@param self StaticGrid StaticGrid
---@param parent string|node The GUI Node container, where grid's items will be placed ---@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 element node Element prefab. Need to get it size
---@param in_row number|nil How many nodes in row can be placed. By default 1 ---@param in_row number|nil How many nodes in row can be placed. By default 1
@ -165,7 +164,6 @@ end
local _temp_pos = vmath.vector3(0) local _temp_pos = vmath.vector3(0)
--- Return pos for grid node index --- Return pos for grid node index
---@param self StaticGrid StaticGrid
---@param index number The grid element index ---@param index number The grid element index
---@return vector3 @Node position ---@return vector3 @Node position
function M:get_pos(index) function M:get_pos(index)
@ -183,7 +181,6 @@ end
--- Return index for grid pos --- Return index for grid pos
---@param self StaticGrid StaticGrid
---@param pos vector3 The node position in the grid ---@param pos vector3 The node position in the grid
---@return number The node index ---@return number The node index
function M:get_index(pos) function M:get_index(pos)
@ -203,7 +200,6 @@ end
--- Return grid index by node --- Return grid index by node
---@param self StaticGrid StaticGrid
---@param node node The gui node in the grid ---@param node node The gui node in the grid
---@return number The node index ---@return number The node index
function M:get_index_by_node(node) function M:get_index_by_node(node)
@ -223,7 +219,6 @@ end
--- Set grid anchor. Default anchor is equal to anchor of grid parent node --- Set grid anchor. Default anchor is equal to anchor of grid parent node
---@param self StaticGrid StaticGrid
---@param anchor vector3 Anchor ---@param anchor vector3 Anchor
function M:set_anchor(anchor) function M:set_anchor(anchor)
self.anchor = anchor self.anchor = anchor
@ -232,7 +227,6 @@ end
--- Update grid content --- Update grid content
---@param self StaticGrid StaticGrid
function M:refresh() function M:refresh()
self:_update(true) self:_update(true)
end end
@ -270,7 +264,6 @@ end
--- Add new item to the grid --- Add new item to the grid
---@param self StaticGrid StaticGrid
---@param item node GUI node ---@param item node GUI node
---@param index number|nil The item position. By default add as last item ---@param index number|nil The item position. By default add as last item
---@param shift_policy number|nil How shift nodes, if required. Default: const.SHIFT.RIGHT ---@param shift_policy number|nil How shift nodes, if required. Default: const.SHIFT.RIGHT
@ -295,7 +288,6 @@ end
--- Set new items to the grid. All previous items will be removed --- Set new items to the grid. All previous items will be removed
---@param self StaticGrid StaticGrid
---@param nodes node[] The new grid nodes ---@param nodes node[] The new grid nodes
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly -- @tparam[opt=false] boolean is_instant If true, update node positions instantly
function M:set_items(nodes, is_instant) function M:set_items(nodes, is_instant)
@ -312,7 +304,6 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted --- Remove the item from the grid. Note that gui node will be not deleted
---@param self StaticGrid StaticGrid
---@param index number The grid node index to remove ---@param index number The grid node index to remove
---@param shift_policy number|nil How shift nodes, if required. Default: const.SHIFT.RIGHT ---@param shift_policy number|nil How shift nodes, if required. Default: const.SHIFT.RIGHT
---@param is_instant boolean|nil If true, update node positions instantly ---@param is_instant boolean|nil If true, update node positions instantly
@ -333,7 +324,6 @@ end
--- Return grid content size --- Return grid content size
---@param self StaticGrid StaticGrid
---@return vector3 The grid content size ---@return vector3 The grid content size
function M:get_size() function M:get_size()
return vmath.vector3( return vmath.vector3(
@ -366,7 +356,6 @@ end
--- Return grid content borders --- Return grid content borders
---@param self StaticGrid StaticGrid
---@return vector3 The grid content borders ---@return vector3 The grid content borders
function M:get_borders() function M:get_borders()
return self.border return self.border
@ -374,7 +363,6 @@ end
--- Return array of all node positions --- Return array of all node positions
---@param self StaticGrid StaticGrid
---@return vector3[] All grid node positions ---@return vector3[] All grid node positions
function M:get_all_pos() function M:get_all_pos()
local result = {} local result = {}
@ -388,7 +376,6 @@ end
--- Change set position function for grid nodes. It will call on --- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position -- update poses on grid elements. Default: gui.set_position
---@param self StaticGrid StaticGrid
---@param callback function Function on node set position ---@param callback function Function on node set position
---@return druid.static_grid Current grid instance ---@return druid.static_grid Current grid instance
function M:set_position_function(callback) function M:set_position_function(callback)
@ -400,7 +387,6 @@ end
--- Clear grid nodes array. GUI nodes will be not deleted! --- Clear grid nodes array. GUI nodes will be not deleted!
-- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear -- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
---@param self StaticGrid StaticGrid
---@return druid.static_grid Current grid instance ---@return druid.static_grid Current grid instance
function M:clear() function M:clear()
self.border.x = 0 self.border.x = 0
@ -419,7 +405,6 @@ end
--- Return StaticGrid offset, where StaticGrid content starts. --- Return StaticGrid offset, where StaticGrid content starts.
---@param self StaticGrid StaticGrid The StaticGrid instance
---@return vector3 The StaticGrid offset ---@return vector3 The StaticGrid offset
function M:get_offset() function M:get_offset()
local borders = self:get_borders() local borders = self:get_borders()
@ -435,7 +420,6 @@ end
--- Set new in_row elements for grid --- Set new in_row elements for grid
---@param self StaticGrid StaticGrid
---@param in_row number The new in_row value ---@param in_row number The new in_row value
---@return druid.static_grid Current grid instance ---@return druid.static_grid Current grid instance
function M:set_in_row(in_row) function M:set_in_row(in_row)
@ -454,7 +438,6 @@ end
--- Set new node size for grid --- Set new node size for grid
---@param self StaticGrid StaticGrid
-- @tparam[opt] number width The new node width -- @tparam[opt] number width The new node width
-- @tparam[opt] number height The new node height -- @tparam[opt] number height The new node height
---@return druid.static_grid Current grid instance ---@return druid.static_grid Current grid instance
@ -479,7 +462,6 @@ end
--- Sort grid nodes by custom comparator function --- Sort grid nodes by custom comparator function
---@param self StaticGrid StaticGrid
---@param comparator function The comparator function. (a, b) -> boolean ---@param comparator function The comparator function. (a, b) -> boolean
---@return druid.static_grid Current grid instance ---@return druid.static_grid Current grid instance
function M:sort_nodes(comparator) function M:sort_nodes(comparator)
@ -489,7 +471,6 @@ end
--- Update grid inner state --- Update grid inner state
---@param self StaticGrid StaticGrid
---@param is_instant boolean|nil If true, node position update instantly, otherwise with set_position_function callback ---@param is_instant boolean|nil If true, node position update instantly, otherwise with set_position_function callback
---@private ---@private
function M:_update(is_instant) function M:_update(is_instant)
@ -500,7 +481,6 @@ end
--- Update first and last indexes of grid nodes --- Update first and last indexes of grid nodes
---@param self StaticGrid StaticGrid
---@private ---@private
function M:_update_indexes() function M:_update_indexes()
self.first_index = nil self.first_index = nil
@ -516,7 +496,6 @@ end
--- Update grid content borders, recalculate min and max values --- Update grid content borders, recalculate min and max values
---@param self StaticGrid StaticGrid
---@private ---@private
function M:_update_borders() function M:_update_borders()
if not self.first_index then if not self.first_index then
@ -535,7 +514,6 @@ end
--- Update grid nodes position --- Update grid nodes position
---@param self StaticGrid StaticGrid
---@param is_instant boolean|nil If true, node position update instantly, otherwise with set_position_function callback ---@param is_instant boolean|nil If true, node position update instantly, otherwise with set_position_function callback
---@private ---@private
function M:_update_pos(is_instant) function M:_update_pos(is_instant)

View File

@ -288,7 +288,6 @@ end
--- The Text constructor --- The Text constructor
---@param self Text Text
---@param node string|node Node name or GUI Text Node itself ---@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. Default: nil ---@param value string|nil Initial text. Default value is node text from GUI scene. Default: nil
---@param adjust_type string|nil Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference. Default: DOWNSCALE ---@param adjust_type string|nil Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference. Default: DOWNSCALE
@ -335,7 +334,6 @@ end
--- Calculate text width with font with respect to trailing space --- Calculate text width with font with respect to trailing space
---@param self Text Text
---@param text|nil string ---@param text|nil string
---@return number Width ---@return number Width
---@return number Height ---@return number Height
@ -360,7 +358,6 @@ end
--- Get chars count by width --- Get chars count by width
---@param self Text Text
---@param width number ---@param width number
---@return number Chars count ---@return number Chars count
function M:get_text_index_by_width(width) function M:get_text_index_by_width(width)
@ -394,7 +391,6 @@ end
--- Set text to text field --- Set text to text field
---@param self Text Text
---@param set_to string Text for node ---@param set_to string Text for node
---@return Text Current text instance ---@return Text Current text instance
function M:set_to(set_to) function M:set_to(set_to)
@ -412,7 +408,6 @@ end
--- Set text area size --- Set text area size
---@param self Text Text
---@param size vector3 The new text area size ---@param size vector3 The new text area size
---@return Text Current text instance ---@return Text Current text instance
function M:set_size(size) function M:set_size(size)
@ -425,7 +420,6 @@ end
--- Set color --- Set color
---@param self Text Text
---@param color vector4 Color for node ---@param color vector4 Color for node
---@return Text Current text instance ---@return Text Current text instance
function M:set_color(color) function M:set_color(color)
@ -437,7 +431,6 @@ end
--- Set alpha --- Set alpha
---@param self Text Text
---@param alpha number Alpha for node ---@param alpha number Alpha for node
---@return Text Current text instance ---@return Text Current text instance
function M:set_alpha(alpha) function M:set_alpha(alpha)
@ -449,7 +442,6 @@ end
--- Set scale --- Set scale
---@param self Text Text
---@param scale vector3 Scale for node ---@param scale vector3 Scale for node
---@return Text Current text instance ---@return Text Current text instance
function M:set_scale(scale) function M:set_scale(scale)
@ -461,7 +453,6 @@ end
--- Set text pivot. Text will re-anchor inside text area --- Set text pivot. Text will re-anchor inside text area
---@param self Text Text
---@param pivot number The gui.PIVOT_* constant ---@param pivot number The gui.PIVOT_* constant
---@return Text Current text instance ---@return Text Current text instance
function M:set_pivot(pivot) function M:set_pivot(pivot)
@ -487,7 +478,6 @@ end
--- Return true, if text with line break --- Return true, if text with line break
---@param self Text Text
---@return boolean Is text node with line break ---@return boolean Is text node with line break
function M:is_multiline() function M:is_multiline()
return gui.get_line_break(self.node) return gui.get_line_break(self.node)
@ -495,7 +485,6 @@ end
--- Set text adjust, refresh the current text visuals, if needed --- Set text adjust, refresh the current text visuals, if needed
---@param self Text Text
---@param adjust_type string|nil See const.TEXT_ADJUST. If pass nil - use current adjust type ---@param adjust_type string|nil See const.TEXT_ADJUST. If pass nil - use current adjust type
---@param minimal_scale number|nil If pass nil - not use minimal scale ---@param minimal_scale number|nil If pass nil - not use minimal scale
---@return Text Current text instance ---@return Text Current text instance
@ -509,7 +498,6 @@ end
--- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types --- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
---@param self Text Text
---@param minimal_scale number If pass nil - not use minimal scale ---@param minimal_scale number If pass nil - not use minimal scale
---@return Text Current text instance ---@return Text Current text instance
function M:set_minimal_scale(minimal_scale) function M:set_minimal_scale(minimal_scale)

View File

@ -90,7 +90,7 @@ end
---@param self T ---@param self T
---@param druid_style table|nil ---@param druid_style table|nil
---@return T self The component itself for chaining ---@return T self The component itself for chaining
function M.set_style(self, druid_style) function M:set_style(druid_style)
---@cast self druid.base_component ---@cast self druid.base_component
self._meta.style = druid_style or {} self._meta.style = druid_style or {}
@ -111,7 +111,7 @@ end
---@param self T ---@param self T
---@param template string|nil ---@param template string|nil
---@return T self The component itself for chaining ---@return T self The component itself for chaining
function M.set_template(self, template) function M:set_template(template)
---@cast self druid.base_component ---@cast self druid.base_component
template = template or "" template = template or ""
@ -142,7 +142,7 @@ end
---Set current component nodes, returned from `gui.clone_tree` function. ---Set current component nodes, returned from `gui.clone_tree` function.
---@param nodes table<hash, node> ---@param nodes table<hash, node>
---@return druid.base_component ---@return druid.base_component
function M.set_nodes(self, nodes) function M:set_nodes(nodes)
self._meta.nodes = nodes self._meta.nodes = nodes
return self return self
end end
@ -150,7 +150,7 @@ end
---Return current component context ---Return current component context
---@return any context Usually it's self of script but can be any other Druid component ---@return any context Usually it's self of script but can be any other Druid component
function M.get_context(self) function M:get_context()
return self._meta.context return self._meta.context
end end
@ -158,15 +158,8 @@ end
---Get component node by node_id. Respect to current template and nodes. ---Get component node by node_id. Respect to current template and nodes.
---@param node_id string|node ---@param node_id string|node
---@return node ---@return node
function M.get_node(self, node_id) function M:get_node(node_id)
if type(node_id) ~= "string" then return helper.get_node(node_id, self:get_template(), self:get_nodes())
-- Assume it's already node from gui.get_node
return node_id
end
local template_name = self:get_template()
local nodes = self:get_nodes()
return helper.get_node(node_id, template_name, nodes)
end end
@ -192,14 +185,14 @@ end
---Get component name ---Get component name
---@return string name The component name + uid ---@return string name The component name + uid
function M.get_name(self) function M:get_name()
return self._component.name .. M.create_uid() return self._component.name .. M.create_uid()
end end
---Get parent component name ---Get parent component name
---@return string|nil parent_name The parent component name if exist or nil ---@return string|nil parent_name The parent component name if exist or nil
function M.get_parent_name(self) function M:get_parent_name()
local parent = self:get_parent_component() local parent = self:get_parent_component()
return parent and parent:get_name() return parent and parent:get_name()
end end
@ -207,7 +200,7 @@ end
---Get component input priority, the bigger number processed first. Default value: 10 ---Get component input priority, the bigger number processed first. Default value: 10
---@return number ---@return number
function M.get_input_priority(self) function M:get_input_priority()
return self._component.input_priority return self._component.input_priority
end end
@ -216,7 +209,7 @@ end
---@param value number ---@param value number
---@param is_temporary boolean|nil If true, the reset input priority will return to previous value ---@param is_temporary boolean|nil If true, the reset input priority will return to previous value
---@return druid.base_component self The component itself for chaining ---@return druid.base_component self The component itself for chaining
function M.set_input_priority(self, value, is_temporary) function M:set_input_priority(value, is_temporary)
assert(value) assert(value)
if self._component.input_priority == value then if self._component.input_priority == value then
@ -241,7 +234,7 @@ end
---Reset component input priority to it's default value, that was set in `create` function or `set_input_priority` ---Reset component input priority to it's default value, that was set in `create` function or `set_input_priority`
---@return druid.base_component self The component itself for chaining ---@return druid.base_component self The component itself for chaining
function M.reset_input_priority(self) function M:reset_input_priority()
self:set_input_priority(self._component.default_input_priority) self:set_input_priority(self._component.default_input_priority)
return self return self
end end
@ -249,7 +242,7 @@ end
---Get component UID, unique identifier created in component creation order. ---Get component UID, unique identifier created in component creation order.
---@return number uid The component uid ---@return number uid The component uid
function M.get_uid(self) function M:get_uid()
return self._component._uid return self._component._uid
end end
@ -259,7 +252,7 @@ end
---Recursive for all children components. ---Recursive for all children components.
---@param state boolean ---@param state boolean
---@return druid.base_component self The component itself for chaining ---@return druid.base_component self The component itself for chaining
function M.set_input_enabled(self, state) function M:set_input_enabled(state)
self._meta.input_enabled = state self._meta.input_enabled = state
for index = 1, #self._meta.children do for index = 1, #self._meta.children do
@ -272,13 +265,12 @@ end
---Get parent component ---Get parent component
---@return druid.base_component|nil parent The parent component if exist or nil ---@return druid.base_component|nil parent The parent component if exist or nil
function M.get_parent_component(self) function M:get_parent_component()
return self._meta.parent return self._meta.parent
end end
--- Setup component context and his style table --- Setup component context and his style table
---@param self BaseComponent BaseComponent
---@param druid_instance table The parent druid instance ---@param druid_instance table The parent druid instance
---@param context table Druid context. Usually it is self of script ---@param context table Druid context. Usually it is self of script
---@param style table Druid style module ---@param style table Druid style module
@ -310,26 +302,23 @@ end
--- Return true, if input priority was changed --- Return true, if input priority was changed
---@param self BaseComponent BaseComponent
---@private ---@private
function M._is_input_priority_changed(self) function M:_is_input_priority_changed()
return self._component._is_input_priority_changed return self._component._is_input_priority_changed
end end
--- Reset is_input_priority_changed field --- Reset is_input_priority_changed field
---@param self BaseComponent BaseComponent
---@private ---@private
function M._reset_input_priority_changed(self) function M:_reset_input_priority_changed()
self._component._is_input_priority_changed = false self._component._is_input_priority_changed = false
end end
--- Get current component interests --- Get current component interests
---@param self BaseComponent BaseComponent
---@return table List of component interests ---@return table List of component interests
---@private ---@private
function M.__get_interests(self) function M:__get_interests()
local instance_class = self._meta.instance_class local instance_class = self._meta.instance_class
if INTERESTS[instance_class] then if INTERESTS[instance_class] then
return INTERESTS[instance_class] return INTERESTS[instance_class]
@ -350,7 +339,7 @@ end
---Get current component nodes ---Get current component nodes
---@return table<hash, node> ---@return table<hash, node>
function M.get_nodes(self) function M:get_nodes()
local nodes = self._meta.nodes local nodes = self._meta.nodes
local parent = self:get_parent_component() local parent = self:get_parent_component()
if parent then if parent then
@ -369,10 +358,9 @@ end
--- Remove child from component children list --- Remove child from component children list
---@param self BaseComponent BaseComponent
---@param child component The druid component instance ---@param child component The druid component instance
---@private ---@private
function M.__remove_child(self, child) function M:__remove_child(child)
for i = #self._meta.children, 1, -1 do for i = #self._meta.children, 1, -1 do
if self._meta.children[i] == child then if self._meta.children[i] == child then
table.remove(self._meta.children, i) table.remove(self._meta.children, i)
@ -383,9 +371,8 @@ end
--- Return all children components, recursive --- Return all children components, recursive
---@param self BaseComponent BaseComponent
---@return table Array of childrens if the Druid component instance ---@return table Array of childrens if the Druid component instance
function M.get_childrens(self) function M:get_childrens()
local childrens = {} local childrens = {}
for i = 1, #self._meta.children do for i = 1, #self._meta.children do

View File

@ -263,7 +263,6 @@ end
--- Set placeholder text --- Set placeholder text
---@param self RichInput RichInput
---@param placeholder_text string The placeholder text ---@param placeholder_text string The placeholder text
function M:set_placeholder(placeholder_text) function M:set_placeholder(placeholder_text)
self.placeholder:set_to(placeholder_text) self.placeholder:set_to(placeholder_text)
@ -272,14 +271,12 @@ end
--- Select input field --- Select input field
---@param self RichInput RichInput
function M:select() function M:select()
self.input:select() self.input:select()
end end
--- Set input field text --- Set input field text
---@param self RichInput RichInput
---@return druid.input Current input instance ---@return druid.input Current input instance
---@param text string The input text ---@param text string The input text
function M:set_text(text) function M:set_text(text)
@ -291,7 +288,6 @@ end
--- Set input field font --- Set input field font
---@param self RichInput RichInput
---@param font hash The font hash ---@param font hash The font hash
---@return druid.input Current input instance ---@return druid.input Current input instance
function M:set_font(font) function M:set_font(font)
@ -303,7 +299,6 @@ end
--- Set input field text --- Set input field text
---@param self RichInput RichInput
function M:get_text() function M:get_text()
return self.input:get_text() return self.input:get_text()
end end
@ -312,7 +307,6 @@ end
--- Set allowed charaters for input field. --- Set allowed charaters for input field.
-- See: https://defold.com/ref/stable/string/ -- See: https://defold.com/ref/stable/string/
-- ex: [%a%d] for alpha and numeric -- ex: [%a%d] for alpha and numeric
---@param self RichInput RichInput
---@param characters string Regulax exp. for validate user input ---@param characters string Regulax exp. for validate user input
---@return RichInput Current instance ---@return RichInput Current instance
function M:set_allowed_characters(characters) function M:set_allowed_characters(characters)

View File

@ -85,7 +85,6 @@ local M = component.create("rich_text")
--- The RichText constructor --- The RichText constructor
---@param self RichText RichText
---@param text_node node|string The text node to make Rich Text ---@param text_node node|string The text node to make Rich Text
---@param value string|nil The initial text value. Default will be gui.get_text(text_node) ---@param value string|nil The initial text value. Default will be gui.get_text(text_node)
function M:init(text_node, value) function M:init(text_node, value)
@ -126,7 +125,6 @@ end
--- Set text for Rich Text --- Set text for Rich Text
---@param self RichText RichText
---@param text string|nil The text to set ---@param text string|nil The text to set
---@return druid.rich_text.word[] words ---@return druid.rich_text.word[] words
---@return druid.rich_text.lines_metrics line_metrics ---@return druid.rich_text.lines_metrics line_metrics
@ -189,7 +187,6 @@ end
--- Get current text --- Get current text
---@param self RichText RichText
---@return string text ---@return string text
function M:get_text() function M:get_text()
return self._last_value return self._last_value
@ -214,7 +211,6 @@ end
--- Get all words, which has a passed tag. --- Get all words, which has a passed tag.
---@param self RichText RichText
---@param tag string ---@param tag string
---@return druid.rich_text.word[] words ---@return druid.rich_text.word[] words
function M:tagged(tag) function M:tagged(tag)
@ -227,7 +223,6 @@ end
---Split a word into it's characters ---Split a word into it's characters
---@param self RichText RichText
---@param word druid.rich_text.word ---@param word druid.rich_text.word
---@return druid.rich_text.word[] characters ---@return druid.rich_text.word[] characters
function M:characters(word) function M:characters(word)

View File

@ -56,7 +56,6 @@ local M = component.create("data_list")
--- The DataList constructor --- The DataList constructor
---@param self DataList DataList
---@param scroll Scroll The Scroll instance for Data List component ---@param scroll Scroll The Scroll instance for Data List component
---@param grid StaticGrid The StaticGrid} or @{DynamicGrid 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]) ---@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 --- Druid System on_remove function
---@param self DataList DataList
function M:on_remove() function M:on_remove()
self:clear() self:clear()
self.scroll.on_scroll:unsubscribe(self._refresh, self) self.scroll.on_scroll:unsubscribe(self._refresh, self)
@ -95,7 +93,6 @@ end
--- Set refresh function for DataList component --- 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 ---@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 ---@return druid.data_list Current DataList instance
function M:set_use_cache(is_use_cache) function M:set_use_cache(is_use_cache)
@ -105,7 +102,6 @@ end
--- Set new data set for DataList component --- Set new data set for DataList component
---@param self DataList DataList
---@param data table The new data array ---@param data table The new data array
---@return druid.data_list Current DataList instance ---@return druid.data_list Current DataList instance
function M:set_data(data) function M:set_data(data)
@ -117,7 +113,6 @@ end
--- Return current data from DataList component --- Return current data from DataList component
---@param self DataList DataList
---@return table The current data array ---@return table The current data array
function M:get_data() function M:get_data()
return self._data return self._data
@ -125,7 +120,6 @@ end
--- Add element to DataList. Currenly untested --- Add element to DataList. Currenly untested
---@param self DataList DataList
---@param data table ---@param data table
---@param index number|nil ---@param index number|nil
---@param shift_policy number|nil The constant from const.SHIFT.* ---@param shift_policy number|nil The constant from const.SHIFT.*
@ -139,7 +133,6 @@ end
--- Remove element from DataList. Currenly untested --- Remove element from DataList. Currenly untested
---@param self DataList DataList
---@param index number|nil ---@param index number|nil
---@param shift_policy number|nil The constant from const.SHIFT.* ---@param shift_policy number|nil The constant from const.SHIFT.*
function M:remove(index, shift_policy) function M:remove(index, shift_policy)
@ -149,7 +142,6 @@ end
--- Remove element from DataList by data value. Currenly untested --- Remove element from DataList by data value. Currenly untested
---@param self DataList DataList
---@param data table ---@param data table
---@param shift_policy number|nil The constant from const.SHIFT.* ---@param shift_policy number|nil The constant from const.SHIFT.*
function M:remove_by_data(data, shift_policy) function M:remove_by_data(data, shift_policy)
@ -162,7 +154,6 @@ end
--- Clear the DataList and refresh visuals --- Clear the DataList and refresh visuals
---@param self DataList DataList
function M:clear() function M:clear()
self._data = {} self._data = {}
self:_refresh() self:_refresh()
@ -170,7 +161,6 @@ end
--- Return index for data value --- Return index for data value
---@param self DataList DataList
---@param data table ---@param data table
function M:get_index(data) function M:get_index(data)
for index, value in pairs(self._data) do for index, value in pairs(self._data) do
@ -184,7 +174,6 @@ end
--- Return all currenly created nodes in DataList --- Return all currenly created nodes in DataList
---@param self DataList DataList
---@return node[] List of created nodes ---@return node[] List of created nodes
function M:get_created_nodes() function M:get_created_nodes()
local nodes = {} local nodes = {}
@ -198,7 +187,6 @@ end
--- Return all currenly created components in DataList --- Return all currenly created components in DataList
---@param self DataList DataList
---@return druid.base_component[] List of created nodes ---@return druid.base_component[] List of created nodes
function M:get_created_components() function M:get_created_components()
local components = {} local components = {}
@ -212,7 +200,6 @@ end
--- Instant scroll to element with passed index --- Instant scroll to element with passed index
---@param self DataList DataList
---@param index number ---@param index number
function M:scroll_to_index(index) function M:scroll_to_index(index)
local pos = self.grid:get_pos(index) local pos = self.grid:get_pos(index)
@ -221,7 +208,6 @@ end
--- Add element at passed index using cache or create new --- Add element at passed index using cache or create new
---@param self DataList DataList
---@param index number ---@param index number
---@private ---@private
function M:_add_at(index) function M:_add_at(index)
@ -255,7 +241,6 @@ end
--- Remove element from passed index and add it to cache if applicable --- Remove element from passed index and add it to cache if applicable
---@param self DataList DataList
---@param index number ---@param index number
---@private ---@private
function M:_remove_at(index) function M:_remove_at(index)
@ -286,7 +271,6 @@ end
--- Refresh all elements in DataList --- Refresh all elements in DataList
---@param self DataList DataList
---@private ---@private
function M:_refresh() function M:_refresh()
self.scroll:set_size(self.grid:get_size_for(#self._data)) 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 --- 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 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 function The callback function
---@param callback_argument any|nil The argument to pass into 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 --- 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 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 ---@param callback_argument any|nil The argument to pass into the callback function
---@return Hotkey Current instance ---@return Hotkey Current instance
@ -174,7 +172,6 @@ end
--- If true, the callback will be triggered on action.repeated --- If true, the callback will be triggered on action.repeated
---@param self Hotkey Hotkey
---@param is_enabled_repeated bool The flag value ---@param is_enabled_repeated bool The flag value
---@return Hotkey ---@return Hotkey
function M:set_repeat(is_enabled_repeated) function M:set_repeat(is_enabled_repeated)

View File

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

View File

@ -42,7 +42,6 @@ local M = component.create("lang_text")
--- The LangText constructor --- The LangText constructor
---@param self LangText LangText
---@param node string|node The node_id or gui.get_node(node_id) ---@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 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 ---@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 --- Setup raw text to lang_text component
---@param self LangText LangText
---@param text string Text for text node ---@param text string Text for text node
---@return LangText Current instance ---@return LangText Current instance
function M:set_to(text) function M:set_to(text)
@ -82,7 +80,6 @@ end
--- Translate the text by locale_id --- Translate the text by locale_id
---@param self LangText LangText
---@param locale_id string Locale id ---@param locale_id string Locale id
---@param a string|nil Optional param to string.format ---@param a string|nil Optional param to string.format
---@param b 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 --- Format string with new text params on localized text
---@param self LangText LangText
---@param a string|nil Optional param to string.format ---@param a string|nil Optional param to string.format
---@param b 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 c string|nil Optional param to string.format

View File

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

View File

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

View File

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

View File

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

View File

@ -207,7 +207,6 @@ function M:fit_into_window()
end end
---@param self druid.container
function M:on_window_resized() function M:on_window_resized()
local x_koef, y_koef = helper.get_screen_aspect_koef() local x_koef, y_koef = helper.get_screen_aspect_koef()
self.x_koef = x_koef self.x_koef = x_koef