mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Annotations update
This commit is contained in:
@@ -45,7 +45,7 @@ local BackHandler = component.create("back_handler")
|
||||
|
||||
--- The @{BackHandler} constructor
|
||||
-- @tparam BackHandler self @{BackHandler}
|
||||
-- @tparam callback callback On back button
|
||||
-- @tparam function callback @The callback(self, custom_args) to call on back event
|
||||
-- @tparam[opt] any custom_args Button events custom arguments
|
||||
-- @local
|
||||
function BackHandler.init(self, callback, custom_args)
|
||||
|
@@ -30,7 +30,7 @@ local component = require("druid.component")
|
||||
local Blocker = component.create("blocker")
|
||||
|
||||
|
||||
--- @{Blocker} constructor
|
||||
--- The @{Blocker} constructor
|
||||
-- @tparam Blocker self @{Blocker}
|
||||
-- @tparam node node Gui node
|
||||
function Blocker.init(self, node)
|
||||
@@ -71,7 +71,7 @@ end
|
||||
--
|
||||
-- Don't change node enabled state itself.
|
||||
-- @tparam Blocker self @{Blocker}
|
||||
-- @tparam bool state Enabled state
|
||||
-- @tparam boolean state Enabled state
|
||||
function Blocker.set_enabled(self, state)
|
||||
self._is_enabled = state
|
||||
end
|
||||
@@ -79,7 +79,7 @@ end
|
||||
|
||||
--- Return blocker enabled state
|
||||
-- @tparam Blocker self @{Blocker}
|
||||
-- @treturn bool True, if blocker is enabled
|
||||
-- @treturn boolean @True, if blocker is enabled
|
||||
function Blocker.is_enabled(self)
|
||||
return self._is_enabled
|
||||
end
|
||||
|
@@ -27,7 +27,7 @@
|
||||
-- print("Also the button component is passed in callback params")
|
||||
-- end
|
||||
--
|
||||
-- local custom_args = "Any variable to pass inside callback"
|
||||
-- local custom_args = "any variable to pass inside callback"
|
||||
-- local button = self.druid:new_button("button_name", on_button_click, custom_args)
|
||||
--
|
||||
-- @module Button
|
||||
@@ -114,7 +114,7 @@
|
||||
-- @tfield DruidEvent on_pressed @{DruidEvent}
|
||||
|
||||
--- Button trigger node
|
||||
-- @tfield Node node
|
||||
-- @tfield node node
|
||||
|
||||
---The GUI node id from button node
|
||||
-- @tfield hash node_id
|
||||
@@ -257,15 +257,15 @@ end
|
||||
--- Component style params.
|
||||
-- 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 function on_click (self, node)
|
||||
-- @tfield function on_click_disabled (self, node)
|
||||
-- @tfield function on_hover (self, node, hover_state)
|
||||
-- @tfield function on_mouse_hover (self, node, hover_state)
|
||||
-- @tfield function on_set_enabled (self, node, enabled_state)
|
||||
-- @tfield function on_click function(self, node)
|
||||
-- @tfield function on_click_disabled function(self, node)
|
||||
-- @tfield function on_hover function(self, node, hover_state)
|
||||
-- @tfield function on_mouse_hover function(self, node, hover_state)
|
||||
-- @tfield function on_set_enabled function(self, node, enabled_state)
|
||||
-- @table style
|
||||
function Button.on_style_change(self, style)
|
||||
self.style = {}
|
||||
self.style.LONGTAP_TIME = style.LONGTAP_TIME or 0.4
|
||||
@@ -282,10 +282,10 @@ end
|
||||
|
||||
--- The @{Button} constructor
|
||||
-- @tparam Button self @{Button}
|
||||
-- @tparam string|Node node Node name or GUI Node itself
|
||||
-- @tparam string|node node Node name or GUI Node itself
|
||||
-- @tparam function callback On click button callback
|
||||
-- @tparam[opt] any custom_args Button events custom arguments
|
||||
-- @tparam[opt] string|Node anim_node Node to animate instead of trigger node.
|
||||
-- @tparam[opt] string|node anim_node Node to animate instead of trigger node.
|
||||
function Button.init(self, node, callback, custom_args, anim_node)
|
||||
self.druid = self:get_druid()
|
||||
self.node = self:get_node(node)
|
||||
@@ -447,7 +447,7 @@ end
|
||||
-- The style.on_set_enabled will be triggered.
|
||||
-- Disabled button is not clickable.
|
||||
-- @tparam Button self @{Button}
|
||||
-- @tparam bool state Enabled state
|
||||
-- @tparam boolean state Enabled state
|
||||
-- @treturn Button Current button instance
|
||||
-- @usage
|
||||
-- button:set_enabled(false)
|
||||
@@ -465,7 +465,7 @@ end
|
||||
--
|
||||
-- By default all Buttons is enabled on creating.
|
||||
-- @tparam Button self @{Button}
|
||||
-- @treturn bool True, if button is enabled now, False overwise
|
||||
-- @treturn boolean @True, if button is enabled now, False overwise
|
||||
-- @usage
|
||||
-- local is_enabled = button:is_enabled()
|
||||
function Button.is_enabled(self)
|
||||
|
@@ -26,16 +26,16 @@
|
||||
-- @tfield DruidEvent on_drag_end @{DruidEvent}
|
||||
|
||||
--- Is component now touching
|
||||
-- @tfield bool is_touch
|
||||
-- @tfield boolean is_touch
|
||||
|
||||
--- Is component now dragging
|
||||
-- @tfield bool is_drag
|
||||
-- @tfield boolean is_drag
|
||||
|
||||
--- Is drag component process vertical dragging. Default - true
|
||||
-- @tfield bool can_x
|
||||
-- @tfield boolean can_x
|
||||
|
||||
--- Is drag component process horizontal. Default - true
|
||||
-- @tfield bool can_y
|
||||
-- @tfield boolean can_y
|
||||
|
||||
--- Current touch x position
|
||||
-- @tfield number x
|
||||
@@ -170,7 +170,7 @@ function Drag.on_style_change(self, style)
|
||||
end
|
||||
|
||||
|
||||
--- Drag component constructor
|
||||
--- The @{Drag} constructor
|
||||
-- @tparam Drag self @{Drag}
|
||||
-- @tparam node node GUI node to detect dragging
|
||||
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
|
||||
@@ -313,7 +313,7 @@ end
|
||||
|
||||
--- Set Drag input enabled or disabled
|
||||
-- @tparam Drag self @{Drag}
|
||||
-- @tparam bool is_enabled
|
||||
-- @tparam boolean is_enabled
|
||||
function Drag.set_enabled(self, is_enabled)
|
||||
self._is_enabled = is_enabled
|
||||
end
|
||||
@@ -321,7 +321,7 @@ end
|
||||
|
||||
--- Check if Drag component is enabled
|
||||
-- @tparam Drag self @{Drag}
|
||||
-- @treturn bool
|
||||
-- @treturn boolean
|
||||
function Drag.is_enabled(self)
|
||||
return self._is_enabled
|
||||
end
|
||||
|
@@ -21,7 +21,7 @@ local component = require("druid.component")
|
||||
local Hover = component.create("hover")
|
||||
|
||||
|
||||
--- Component init function
|
||||
--- The @{Hover} constructor
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function on_hover_callback Hover callback
|
||||
@@ -89,7 +89,7 @@ end
|
||||
|
||||
--- Set hover state
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam bool state The hover state
|
||||
-- @tparam boolean state The hover state
|
||||
function Hover.set_hover(self, state)
|
||||
if self._is_hovered ~= state then
|
||||
self._is_hovered = state
|
||||
@@ -100,7 +100,7 @@ end
|
||||
|
||||
--- Return current hover state. True if touch action was on the node at current time
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @treturn bool The current hovered state
|
||||
-- @treturn boolean The current hovered state
|
||||
function Hover.is_hovered(self)
|
||||
return self._is_hovered
|
||||
end
|
||||
@@ -108,7 +108,7 @@ end
|
||||
|
||||
--- Set mouse hover state
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam bool state The mouse hover state
|
||||
-- @tparam boolean state The mouse hover state
|
||||
function Hover.set_mouse_hover(self, state)
|
||||
if self._is_mouse_hovered ~= state then
|
||||
self._is_mouse_hovered = state
|
||||
@@ -119,7 +119,7 @@ end
|
||||
|
||||
--- Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @treturn bool The current hovered state
|
||||
-- @treturn boolean The current hovered state
|
||||
function Hover.is_mouse_hovered(self)
|
||||
return self._is_mouse_hovered
|
||||
end
|
||||
@@ -138,7 +138,7 @@ end
|
||||
-- If hover is not enabled, it will not generate
|
||||
-- any hover events
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam bool state The hover enabled state
|
||||
-- @tparam boolean state The hover enabled state
|
||||
function Hover.set_enabled(self, state)
|
||||
self._is_enabled = state
|
||||
|
||||
@@ -155,7 +155,7 @@ end
|
||||
|
||||
--- Return current hover enabled state
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @treturn bool The hover enabled state
|
||||
-- @treturn boolean The hover enabled state
|
||||
function Hover.is_enabled(self)
|
||||
return self._is_enabled
|
||||
end
|
||||
|
@@ -53,9 +53,6 @@
|
||||
--- Scroll content node
|
||||
-- @tfield node content_node
|
||||
|
||||
--- Flag, if scroll now moving by inertion
|
||||
-- @tfield bool is_inert
|
||||
|
||||
--- Current inert speed
|
||||
-- @tfield vector3 inertion
|
||||
|
||||
@@ -78,7 +75,7 @@
|
||||
-- @tfield[opt] number selected
|
||||
|
||||
--- Flag, if scroll now animating by gui.animate
|
||||
-- @tfield bool is_animate
|
||||
-- @tfield boolean is_animate
|
||||
|
||||
---
|
||||
|
||||
@@ -131,10 +128,10 @@ end
|
||||
-- @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] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled
|
||||
-- @tfield[opt=0] bool WHEEL_SCROLL_SPEED The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling
|
||||
-- @tfield[opt=false] bool WHEEL_SCROLL_INVERTED If true, invert direction for touchpad and mouse wheel scroll
|
||||
-- @tfield[opt=false] bool WHEEL_SCROLL_BY_INERTION If true, wheel will add inertion to scroll. Direct set position otherwise.
|
||||
-- @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.
|
||||
function Scroll.on_style_change(self, style)
|
||||
self.style = {}
|
||||
self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0
|
||||
@@ -158,7 +155,7 @@ function Scroll.on_style_change(self, style)
|
||||
end
|
||||
|
||||
|
||||
--- @{Scroll} constructor
|
||||
--- The @{Scroll} constructor
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam string|node view_node GUI view scroll node
|
||||
-- @tparam string|node content_node GUI content scroll node
|
||||
@@ -237,7 +234,7 @@ end
|
||||
--- Start scroll to target point.
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam vector3 point Target point
|
||||
-- @tparam[opt] bool is_instant Instant scroll flag
|
||||
-- @tparam[opt] boolean is_instant Instant scroll flag
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0), true)
|
||||
function Scroll.scroll_to(self, point, is_instant)
|
||||
@@ -271,7 +268,7 @@ end
|
||||
--- Scroll to item in scroll by point index.
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam number index Point index
|
||||
-- @tparam[opt] bool skip_cb If true, skip the point callback
|
||||
-- @tparam[opt] boolean skip_cb If true, skip the point callback
|
||||
function Scroll.scroll_to_index(self, index, skip_cb)
|
||||
if not self.points then
|
||||
return
|
||||
@@ -294,7 +291,7 @@ end
|
||||
--- Start scroll to target scroll percent
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam vector3 percent target percent
|
||||
-- @tparam[opt] bool is_instant instant scroll flag
|
||||
-- @tparam[opt] boolean is_instant instant scroll flag
|
||||
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
|
||||
function Scroll.scroll_to_percent(self, percent, is_instant)
|
||||
local border = self.available_pos
|
||||
@@ -342,7 +339,7 @@ end
|
||||
-- If disabled, scroll through points (if exist)
|
||||
-- If no points, just simple drag without inertion
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam bool state Inert scroll state
|
||||
-- @tparam boolean state Inert scroll state
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll.set_inert(self, state)
|
||||
self._is_inert = state
|
||||
@@ -353,7 +350,7 @@ end
|
||||
|
||||
--- Return if scroll have inertion.
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @treturn bool If scroll have inertion
|
||||
-- @treturn boolean @If scroll have inertion
|
||||
function Scroll.is_inert(self)
|
||||
return self._is_inert
|
||||
end
|
||||
@@ -400,7 +397,7 @@ end
|
||||
|
||||
--- Lock or unlock horizontal scroll
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam bool state True, if horizontal scroll is enabled
|
||||
-- @tparam boolean state True, if horizontal scroll is enabled
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll.set_horizontal_scroll(self, state)
|
||||
self._is_horizontal_scroll = state
|
||||
@@ -411,7 +408,7 @@ end
|
||||
|
||||
--- Lock or unlock vertical scroll
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam bool state True, if vertical scroll is enabled
|
||||
-- @tparam boolean state True, if vertical scroll is enabled
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll.set_vertical_scroll(self, state)
|
||||
self._is_vertical_scroll = state
|
||||
|
@@ -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] bool IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets
|
||||
-- @tfield[opt=false] bool IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets
|
||||
-- @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
|
||||
function StaticGrid.on_style_change(self, style)
|
||||
self.style = {}
|
||||
self.style.IS_DYNAMIC_NODE_POSES = style.IS_DYNAMIC_NODE_POSES or false
|
||||
@@ -113,7 +113,7 @@ end
|
||||
|
||||
--- The @{StaticGrid} constructor
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam string|Node parent The GUI Node container, where grid's items will be placed
|
||||
-- @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
|
||||
function StaticGrid.init(self, parent, element, in_row)
|
||||
@@ -151,7 +151,7 @@ local _temp_pos = vmath.vector3(0)
|
||||
--- Return pos for grid node index
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam number index The grid element index
|
||||
-- @treturn vector3 Node position
|
||||
-- @treturn vector3 @Node position
|
||||
function StaticGrid.get_pos(self, index)
|
||||
local row = math.ceil(index / self.in_row) - 1
|
||||
local col = (index - row * self.in_row) - 1
|
||||
@@ -241,7 +241,7 @@ end
|
||||
-- @tparam number index The grid node index to remove
|
||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
||||
-- @treturn Node The deleted gui node from grid
|
||||
-- @treturn node The deleted gui node from grid
|
||||
function StaticGrid.remove(self, index, shift_policy, is_instant)
|
||||
assert(self.nodes[index], "No grid item at given index " .. index)
|
||||
|
||||
@@ -379,7 +379,7 @@ end
|
||||
|
||||
--- Update grid inner state
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function StaticGrid._update(self, is_instant)
|
||||
self:_update_indexes()
|
||||
@@ -425,7 +425,7 @@ end
|
||||
|
||||
--- Update grid nodes position
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function StaticGrid._update_pos(self, is_instant)
|
||||
local zero_offset = self:_get_zero_offset()
|
||||
|
@@ -222,7 +222,7 @@ function Text.on_style_change(self, style)
|
||||
end
|
||||
|
||||
|
||||
--- @{Text} constructor
|
||||
--- The @{Text} constructor
|
||||
-- @tparam Text self @{Text}
|
||||
-- @tparam string|node node Node name or GUI Text Node itself
|
||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||
@@ -358,7 +358,7 @@ end
|
||||
|
||||
--- Set text pivot. Text will re-anchor inside text area
|
||||
-- @tparam Text self @{Text}
|
||||
-- @tparam gui.pivot pivot Gui pivot constant
|
||||
-- @tparam number pivot The gui.PIVOT_* constant
|
||||
-- @treturn Text Current text instance
|
||||
function Text.set_pivot(self, pivot)
|
||||
local prev_pivot = gui.get_pivot(self.node)
|
||||
@@ -384,7 +384,7 @@ end
|
||||
|
||||
--- Return true, if text with line break
|
||||
-- @tparam Text self @{Text}
|
||||
-- @treturn bool Is text node with line break
|
||||
-- @treturn boolean Is text node with line break
|
||||
function Text.is_multiline(self)
|
||||
return gui.get_line_break(self.node)
|
||||
end
|
||||
|
Reference in New Issue
Block a user