Update doc links, update emmylua generator

This commit is contained in:
Insality
2022-03-08 20:21:39 +02:00
parent a846adf97b
commit f801bb6862
27 changed files with 655 additions and 439 deletions

View File

@@ -6,7 +6,7 @@
-- @alias druid.back_handler
--- On back handler callback(self, params)
-- @tfield druid_event on_back
-- @tfield DruidEvent on_back @{DruidEvent}
--- Params to back callback
-- @tfield any params
@@ -21,7 +21,7 @@ local BackHandler = component.create("back_handler")
--- Component init function
-- @tparam BackHandler self
-- @tparam BackHandler self @{BackHandler}
-- @tparam callback callback On back button
-- @tparam[opt] any params Callback argument
function BackHandler.init(self, callback, params)
@@ -31,7 +31,7 @@ end
--- Input handler for component
-- @tparam BackHandler self
-- @tparam BackHandler self @{BackHandler}
-- @tparam string action_id on_input action id
-- @tparam table action on_input action
function BackHandler.on_input(self, action_id, action)

View File

@@ -17,7 +17,7 @@ local Blocker = component.create("blocker")
--- Component init function
-- @tparam Blocker self
-- @tparam Blocker self @{Blocker}
-- @tparam node node Gui node
function Blocker.init(self, node)
self.node = self:get_node(node)
@@ -44,7 +44,7 @@ end
--- Set enabled blocker component state
-- @tparam Blocker self
-- @tparam Blocker self @{Blocker}
-- @tparam bool state Enabled state
function Blocker.set_enabled(self, state)
gui.set_enabled(self.node, state)
@@ -52,7 +52,7 @@ end
--- Return blocked enabled state
-- @tparam Blocker self
-- @tparam Blocker self @{Blocker}
-- @treturn bool True, if blocker is enabled
function Blocker.is_enabled(self)
return gui.is_enabled(self.node)

View File

@@ -6,22 +6,22 @@
-- @alias druid.button
--- On release button callback(self, params, button_instance)
-- @tfield druid_event on_click
-- @tfield DruidEvent on_click @{DruidEvent}
--- On repeated action button callback(self, params, button_instance, click_amount)
-- @tfield druid_event on_repeated_click
-- @tfield DruidEvent on_repeated_click @{DruidEvent}
---On long tap button callback(self, params, button_instance, time)
-- @tfield druid_event on_long_click
-- @tfield DruidEvent on_long_click @{DruidEvent}
---On double tap button callback(self, params, button_instance, click_amount)
-- @tfield druid_event on_double_click
-- @tfield DruidEvent on_double_click @{DruidEvent}
---On button hold before long_click callback(self, params, button_instance, time)
-- @tfield druid_event on_hold_callback
-- @tfield DruidEvent on_hold_callback @{DruidEvent}
---On click outside of button(self, params, button_instance)
-- @tfield druid_event on_click_outside
-- @tfield DruidEvent on_click_outside @{DruidEvent}
---Trigger node
-- @tfield node node
@@ -45,7 +45,7 @@
-- @tfield any params
---Druid hover logic component
-- @tfield druid.hover hover
-- @tfield Hover hover @{Hover}
---Restriction zone
-- @tfield[opt] node click_zone
@@ -193,7 +193,7 @@ end
--- Component init function
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam node node Gui node
-- @tparam function callback Button callback
-- @tparam[opt] table params Button callback params
@@ -339,7 +339,7 @@ end
--- Set enabled button component state
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam bool state Enabled state
-- @treturn Button Current button instance
function Button.set_enabled(self, state)
@@ -352,7 +352,7 @@ end
--- Return button enabled state
-- @tparam Button self
-- @tparam Button self @{Button}
-- @treturn bool True, if button is enabled
function Button.is_enabled(self)
return not self.disabled
@@ -361,7 +361,7 @@ end
--- Strict button click area. Useful for
-- no click events outside stencil node
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam node zone Gui node
-- @treturn Button Current button instance
function Button.set_click_zone(self, zone)
@@ -373,7 +373,7 @@ end
--- Set key-code to trigger this button
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam hash key The action_id of the key
-- @treturn Button Current button instance
function Button.set_key_trigger(self, key)

View File

@@ -9,19 +9,19 @@
-- @alias druid.drag
--- Event on touch start callback(self)
-- @tfield druid_event on_touch_start
-- @tfield DruidEvent on_touch_start @{DruidEvent}
--- Event on touch end callback(self)
-- @tfield druid_event on_touch_end
-- @tfield DruidEvent on_touch_end @{DruidEvent}
--- Event on drag start callback(self)
-- @tfield druid_event on_drag_start
-- @tfield DruidEvent on_drag_start @{DruidEvent}
--- on drag progress callback(self, dx, dy)
-- @tfield druid_event on_drag Event
-- @tfield DruidEvent on_drag Event @{DruidEvent}
--- Event on drag end callback(self)
-- @tfield druid_event on_drag_end
-- @tfield DruidEvent on_drag_end @{DruidEvent}
--- Is component now touching
-- @tfield bool is_touch
@@ -162,7 +162,7 @@ end
--- Drag component constructor
-- @tparam Drag self
-- @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)
function Drag.init(self, node, on_drag_callback)
@@ -277,7 +277,7 @@ end
--- Strict drag click area. Useful for
-- restrict events outside stencil node
-- @tparam Drag self
-- @tparam Drag self @{Drag}
-- @tparam node node Gui node
function Drag.set_click_zone(self, node)
self.click_zone = self:get_node(node)

View File

@@ -6,10 +6,10 @@
-- @alias druid.hover
--- On hover callback(self, state)
-- @tfield druid_event on_hover
-- @tfield DruidEvent on_hover @{DruidEvent}
--- On mouse hover callback(self, state)
-- @tfield druid_event on_mouse_hover
-- @tfield DruidEvent on_mouse_hover @{DruidEvent}
---
@@ -22,7 +22,7 @@ local Hover = component.create("hover")
--- Component init function
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam node node Gui node
-- @tparam function on_hover_callback Hover callback
function Hover.init(self, node, on_hover_callback)
@@ -90,7 +90,7 @@ end
--- Set hover state
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam bool state The hover state
function Hover.set_hover(self, state)
if self._is_hovered ~= state then
@@ -100,7 +100,7 @@ function Hover.set_hover(self, state)
end
--- Set mouse hover state
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam bool state The mouse hover state
function Hover.set_mouse_hover(self, state)
if self._is_mouse_hovered ~= state then
@@ -112,7 +112,7 @@ end
--- Strict hover click area. Useful for
-- no click events outside stencil node
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam node zone Gui node
function Hover.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)
@@ -122,7 +122,7 @@ end
--- Set enable state of hover component.
-- If hover is not enabled, it will not generate
-- any hover events
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam bool state The hover enabled state
function Hover.set_enabled(self, state)
self._is_enabled = state
@@ -139,7 +139,7 @@ end
--- Return current hover enabled state
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @treturn bool The hover enabled state
function Hover.is_enabled(self)
return self._is_enabled

View File

@@ -13,13 +13,13 @@
--- On scroll move callback(self, position)
-- @tfield druid_event on_scroll
-- @tfield DruidEvent on_scroll @{DruidEvent}
--- On scroll_to function callback(self, target, is_instant)
-- @tfield druid_event on_scroll_to
-- @tfield DruidEvent on_scroll_to @{DruidEvent}
--- On scroll_to_index function callback(self, index, point)
-- @tfield druid_event on_point_scroll
-- @tfield DruidEvent on_point_scroll @{DruidEvent}
--- Scroll view node
-- @tfield node view_node
@@ -46,7 +46,7 @@
-- @tfield vector3 available_size
--- Drag Druid component
-- @tfield Drag drag
-- @tfield Drag drag @{Drag}
--- Current index of points of interests
-- @tfield[opt] number selected
@@ -133,7 +133,7 @@ end
--- Scroll constructor
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam node view_node GUI view scroll node
-- @tparam node content_node GUI content scroll node
function Scroll.init(self, view_node, content_node)
@@ -211,7 +211,7 @@ end
--- Start scroll to target point.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam vector3 point Target point
-- @tparam[opt] bool is_instant Instant scroll flag
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
@@ -245,7 +245,7 @@ end
--- Scroll to item in scroll by point index.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam number index Point index
-- @tparam[opt] bool skip_cb If true, skip the point callback
function Scroll.scroll_to_index(self, index, skip_cb)
@@ -268,7 +268,7 @@ end
--- Start scroll to target scroll percent
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam vector3 percent target percent
-- @tparam[opt] bool is_instant instant scroll flag
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
@@ -287,7 +287,7 @@ end
--- Return current scroll progress status.
-- Values will be in [0..1] interval
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @treturn vector3 New vector with scroll progress values
function Scroll.get_percent(self)
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
@@ -299,7 +299,7 @@ end
--- Set scroll content size.
-- It will change content gui node size
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam vector3 size The new size for content node
-- @tparam vector3 offset Offset value to set, where content is starts
-- @treturn druid.scroll Current scroll instance
@@ -317,7 +317,7 @@ end
--- Enable or disable scroll inert.
-- If disabled, scroll through points (if exist)
-- If no points, just simple drag without inertion
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam bool state Inert scroll state
-- @treturn druid.scroll Current scroll instance
function Scroll.set_inert(self, state)
@@ -328,7 +328,7 @@ end
--- Return if scroll have inertion.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @treturn bool If scroll have inertion
function Scroll.is_inert(self)
return self._is_inert
@@ -337,7 +337,7 @@ end
--- Set extra size for scroll stretching.
-- Set 0 to disable stretching effect
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area
-- @treturn druid.scroll Current scroll instance
function Scroll.set_extra_stretch_size(self, stretch_size)
@@ -349,7 +349,7 @@ end
--- Return vector of scroll size with width and height.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @treturn vector3 Available scroll size
function Scroll.get_scroll_size(self)
return self.available_size
@@ -358,7 +358,7 @@ end
--- Set points of interest.
-- Scroll will always centered on closer points
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam table points Array of vector3 points
-- @treturn druid.scroll Current scroll instance
function Scroll.set_points(self, points)
@@ -375,7 +375,7 @@ end
--- Lock or unlock horizontal scroll
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam bool state True, if horizontal scroll is enabled
-- @treturn druid.scroll Current scroll instance
function Scroll.set_horizontal_scroll(self, state)
@@ -386,7 +386,7 @@ end
--- Lock or unlock vertical scroll
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam bool state True, if vertical scroll is enabled
-- @treturn druid.scroll Current scroll instance
function Scroll.set_vertical_scroll(self, state)
@@ -398,7 +398,7 @@ end
--- Check node if it visible now on scroll.
-- Extra border is not affected. Return true for elements in extra scroll zone
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam node node The node to check
-- @treturn boolean True if node in visible scroll area
function Scroll.is_node_in_view(self, node)
@@ -421,7 +421,7 @@ end
--- Bind the grid component (Static or Dynamic) to recalculate
-- scroll size on grid changes
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam StaticGrid|DynamicGrid grid Druid grid component
-- @treturn druid.scroll Current scroll instance
function Scroll.bind_grid(self, grid)
@@ -524,7 +524,7 @@ function Scroll._check_soft_zone(self)
end
--- Cancel animation on other animation or input touch
-- Cancel animation on other animation or input touch
function Scroll._cancel_animate(self)
self.inertion.x = 0
self.inertion.y = 0

View File

@@ -7,19 +7,19 @@
-- @alias druid.static_grid
--- On item add callback(self, node, index)
-- @tfield druid_event on_add_item
-- @tfield DruidEvent on_add_item @{DruidEvent}
--- On item remove callback(self, index)
-- @tfield druid_event on_remove_item
-- @tfield DruidEvent on_remove_item @{DruidEvent}
--- On item add, remove or change in_row callback(self, index|nil)
-- @tfield druid_event on_change_items
-- @tfield DruidEvent on_change_items @{DruidEvent}
--- On grid clear callback(self)
-- @tfield druid_event on_clear
-- @tfield DruidEvent on_clear @{DruidEvent}
--- On update item positions callback(self)
-- @tfield druid_event on_update_positions
-- @tfield DruidEvent on_update_positions @{DruidEvent}
--- Parent gui node
-- @tfield node parent
@@ -79,7 +79,7 @@ end
--- Component init function
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam node parent The gui node parent, where 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
@@ -117,7 +117,7 @@ end
local _temp_pos = vmath.vector3(0)
--- Return pos for grid node index
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number index The grid element index
-- @treturn vector3 Node position
function StaticGrid.get_pos(self, index)
@@ -135,7 +135,7 @@ end
--- Return index for grid pos
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam vector3 pos The node position in the grid
-- @treturn number The node index
function StaticGrid.get_index(self, pos)
@@ -151,7 +151,7 @@ end
--- Return grid index by node
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam node node The gui node in the grid
-- @treturn number The node index
function StaticGrid.get_index_by_node(self, node)
@@ -171,7 +171,7 @@ end
--- Set grid anchor. Default anchor is equal to anchor of grid parent node
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam vector3 anchor Anchor
function StaticGrid.set_anchor(self, anchor)
self.anchor = anchor
@@ -180,7 +180,7 @@ end
--- Add new item to the grid
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam node item Gui node
-- @tparam[opt] number index The item position. By default add as last item
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
@@ -219,7 +219,7 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @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
@@ -252,7 +252,7 @@ end
--- Return grid content size
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3 The grid content size
function StaticGrid.get_size(self)
return vmath.vector3(
@@ -286,7 +286,7 @@ end
--- Return grid content borders
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3 The grid content borders
function StaticGrid.get_borders(self)
return self.border
@@ -294,7 +294,7 @@ end
--- Return array of all node positions
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3[] All grid node positions
function StaticGrid.get_all_pos(self)
local result = {}
@@ -308,7 +308,7 @@ end
--- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam function callback Function on node set position
-- @treturn druid.static_grid Current grid instance
function StaticGrid.set_position_function(self, callback)
@@ -320,7 +320,7 @@ end
--- 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
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn druid.static_grid Current grid instance
function StaticGrid.clear(self)
self.border.x = 0
@@ -338,7 +338,7 @@ end
--- Return StaticGrid offset, where StaticGrid content starts.
-- @tparam StaticGrid self The StaticGrid instance
-- @tparam StaticGrid self @{StaticGrid} The StaticGrid instance
-- @treturn vector3 The StaticGrid offset
function StaticGrid:get_offset()
local borders = self:get_borders()
@@ -354,7 +354,7 @@ end
--- Set new in_row elements for grid
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number in_row The new in_row value
-- @treturn druid.static_grid Current grid instance
function StaticGrid.set_in_row(self, in_row)
@@ -368,7 +368,7 @@ end
--- Update grid inner state
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function StaticGrid._update(self, is_instant)
@@ -379,7 +379,7 @@ end
--- Update first and last indexes of grid nodes
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @local
function StaticGrid._update_indexes(self)
self.first_index = nil
@@ -395,7 +395,7 @@ end
--- Update grid content borders, recalculate min and max values
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @local
function StaticGrid._update_borders(self)
if not self.first_index then
@@ -414,7 +414,7 @@ end
--- Update grid nodes position
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function StaticGrid._update_pos(self, is_instant)

View File

@@ -14,7 +14,7 @@
-- @tparam[opt] node click_zone
--- Trigger on swipe event(self, swipe_side, dist, delta_time
-- @tfield druid_event on_swipe)
-- @tfield DruidEvent on_swipe) @{DruidEvent}
---
@@ -84,7 +84,7 @@ end
--- Component init function
-- @tparam Swipe self
-- @tparam Swipe self @{Swipe}
-- @tparam node node Gui node
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
function Swipe.init(self, node, on_swipe_callback)
@@ -149,7 +149,7 @@ end
--- Strict swipe click area. Useful for
-- restrict events outside stencil node
-- @tparam Swipe self
-- @tparam Swipe self @{Swipe}
-- @tparam node zone Gui node
function Swipe.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)

View File

@@ -8,13 +8,13 @@
-- @alias druid.text
--- On set text callback(self, text)
-- @tfield druid_event on_set_text
-- @tfield DruidEvent on_set_text @{DruidEvent}
--- On adjust text size callback(self, new_scale)
-- @tfield druid_event on_update_text_scale
-- @tfield DruidEvent on_update_text_scale @{DruidEvent}
--- On change pivot callback(self, pivot)
-- @tfield druid_event on_set_pivot
-- @tfield DruidEvent on_set_pivot @{DruidEvent}
--- Text node
-- @tfield node node
@@ -185,7 +185,7 @@ end
--- Component init function
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam node node Gui text node
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
-- @tparam[opt=0] int adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
@@ -234,7 +234,7 @@ end
--- Calculate text width with font with respect to trailing space
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam[opt] string text
function Text.get_text_width(self, text)
text = text or self.last_value
@@ -255,7 +255,7 @@ end
--- Set text to text field
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam string set_to Text for node
-- @treturn Text Current text instance
function Text.set_to(self, set_to)
@@ -273,7 +273,7 @@ end
--- Set color
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam vector4 color Color for node
-- @treturn Text Current text instance
function Text.set_color(self, color)
@@ -285,7 +285,7 @@ end
--- Set alpha
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam number alpha Alpha for node
-- @treturn Text Current text instance
function Text.set_alpha(self, alpha)
@@ -297,7 +297,7 @@ end
--- Set scale
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam vector3 scale Scale for node
-- @treturn Text Current text instance
function Text.set_scale(self, scale)
@@ -309,7 +309,7 @@ end
--- Set text pivot. Text will re-anchor inside text area
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam gui.pivot pivot Gui pivot constant
-- @treturn Text Current text instance
function Text.set_pivot(self, pivot)
@@ -335,7 +335,7 @@ end
--- Return true, if text with line break
-- @tparam Text self
-- @tparam Text self @{Text}
-- @treturn bool Is text node with line break
function Text.is_multiline(self)
return gui.get_line_break(self.node)
@@ -343,7 +343,7 @@ end
--- Set text adjust, refresh the current text visuals, if needed
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
-- @tparam[opt] number minimal_scale If pass nil - not use minimal scale
-- @treturn Text Current text instance
@@ -357,7 +357,7 @@ end
--- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam number minimal_scale If pass nil - not use minimal scale
-- @treturn Text Current text instance
function Text.set_minimal_scale(self, minimal_scale)