Update API pages

This commit is contained in:
Insality 2025-04-20 12:15:31 +03:00
parent 6e1998b822
commit c33dbd5942
24 changed files with 82 additions and 460 deletions

View File

@ -38,7 +38,7 @@ The Back Handler constructor
## Fields ## Fields
<a name="on_back"></a> <a name="on_back"></a>
- **on_back** (_event_): Trigger on back handler action, fun(self, params) - **on_back** (_event_): fun(self: druid.back_handler, params: any?) Trigger on back handler action
<a name="params"></a> <a name="params"></a>
- **params** (_any_): Custom args to pass in the callback - **params** (_any_): Custom args to pass in the callback

View File

@ -112,10 +112,10 @@ button:is_enabled()
``` ```
Get button enabled state. Get button enabled state.
By default all Buttons is enabled on creating. By default all Buttons are enabled on creating.
- **Returns:** - **Returns:**
- `is_enabled` *(boolean)*: True, if button is enabled now, False overwise - `is_enabled` *(boolean)*: True, if button is enabled now, False otherwise
### set_click_zone ### set_click_zone
@ -125,7 +125,7 @@ button:set_click_zone([zone])
``` ```
Set additional button click area. Set additional button click area.
Useful to restrict click outside out stencil node or scrollable content. Useful to restrict click outside of stencil node or scrollable content.
If button node placed inside stencil node, it will be automatically set to this stencil node. If button node placed inside stencil node, it will be automatically set to this stencil node.
- **Parameters:** - **Parameters:**
@ -168,11 +168,11 @@ Get current key name to trigger this button.
button:set_check_function([check_function], [failure_callback]) button:set_check_function([check_function], [failure_callback])
``` ```
Set function for additional check for button click availability Set function for additional check for button click availability.
- **Parameters:** - **Parameters:**
- `[check_function]` *(function|nil)*: Should return true or false. If true - button can be pressed. - `[check_function]` *(function|nil)*: Should return true or false. If true - button can be pressed.
- `[failure_callback]` *(function|nil)*: Function will be called on button click, if check function return false - `[failure_callback]` *(function|nil)*: Function will be called on button click, if check function returns false
- **Returns:** - **Returns:**
- `self` *(druid.button)*: The current button instance - `self` *(druid.button)*: The current button instance
@ -186,7 +186,7 @@ button:set_web_user_interaction([is_web_mode])
Set Button mode to work inside user HTML5 interaction event. Set Button mode to work inside user HTML5 interaction event.
It's required to make protected things like copy & paste text, show mobile keyboard, etc It's required to make protected things like copy & paste text, show mobile keyboard, etc
The HTML5 button's doesn't call any events except on_click event. The HTML5 button doesn't call any events except on_click event.
If the game is not HTML, html mode will be not enabled If the game is not HTML, html mode will be not enabled
- **Parameters:** - **Parameters:**
@ -198,25 +198,25 @@ If the game is not HTML, html mode will be not enabled
## Fields ## Fields
<a name="on_click"></a> <a name="on_click"></a>
- **on_click** (_event_): function(self, custom_args, button_instance) - **on_click** (_event_): fun(self, custom_args, button_instance)
<a name="on_pressed"></a> <a name="on_pressed"></a>
- **on_pressed** (_event_): function(self, custom_args, button_instance) - **on_pressed** (_event_): fun(self, custom_args, button_instance)
<a name="on_repeated_click"></a> <a name="on_repeated_click"></a>
- **on_repeated_click** (_event_): function(self, custom_args, button_instance, click_count) Repeated click callback, while holding the button - **on_repeated_click** (_event_): fun(self, custom_args, button_instance, click_count) Repeated click callback, while holding the button
<a name="on_long_click"></a> <a name="on_long_click"></a>
- **on_long_click** (_event_): function(self, custom_args, button_instance, hold_time) Callback on long button tap - **on_long_click** (_event_): fun(self, custom_args, button_instance, hold_time) Callback on long button tap
<a name="on_double_click"></a> <a name="on_double_click"></a>
- **on_double_click** (_event_): function(self, custom_args, button_instance, click_amount) Different callback, if tap button 2+ in row - **on_double_click** (_event_): fun(self, custom_args, button_instance, click_amount) Different callback, if tap button 2+ in row
<a name="on_hold_callback"></a> <a name="on_hold_callback"></a>
- **on_hold_callback** (_event_): function(self, custom_args, button_instance, press_time) Hold callback, before long_click trigger - **on_hold_callback** (_event_): fun(self, custom_args, button_instance, press_time) Hold callback, before long_click trigger
<a name="on_click_outside"></a> <a name="on_click_outside"></a>
- **on_click_outside** (_event_): function(self, custom_args, button_instance) - **on_click_outside** (_event_): fun(self, custom_args, button_instance)
<a name="node"></a> <a name="node"></a>
- **node** (_node_): Clickable node - **node** (_node_): Clickable node

View File

@ -243,13 +243,13 @@ Get full template name.
--- ---
```lua ```lua
component:set_nodes(nodes) component:set_nodes([nodes])
``` ```
Set current component nodes, returned from `gui.clone_tree` function. Set current component nodes, returned from `gui.clone_tree` function.
- **Parameters:** - **Parameters:**
- `nodes` *(table<hash, node>)*: - `[nodes]` *(string|node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone or node id to clone
- **Returns:** - **Returns:**
- `` *(druid.component)*: - `` *(druid.component)*:
@ -292,7 +292,7 @@ Get Druid instance for inner component creation.
- **Parameters:** - **Parameters:**
- `[template]` *(string|nil)*: - `[template]` *(string|nil)*:
- `[nodes]` *(table<hash, node>|nil)*: - `[nodes]` *(string|node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone or node id to clone
- **Returns:** - **Returns:**
- `` *(druid.instance)*: - `` *(druid.instance)*:

View File

@ -334,13 +334,13 @@ Strict drag scroll area. Useful for
- **click_zone** (_node_): Optional click zone to restrict scroll area - **click_zone** (_node_): Optional click zone to restrict scroll area
<a name="on_scroll"></a> <a name="on_scroll"></a>
- **on_scroll** (_event_): Triggered on scroll move with fun(self, position) - **on_scroll** (_event_): fun(self: druid.scroll, position: vector3) Triggered on scroll move
<a name="on_scroll_to"></a> <a name="on_scroll_to"></a>
- **on_scroll_to** (_event_): Triggered on scroll_to with fun(self, target, is_instant) - **on_scroll_to** (_event_): fun(self: druid.scroll, target: vector3, is_instant: boolean) Triggered on scroll_to
<a name="on_point_scroll"></a> <a name="on_point_scroll"></a>
- **on_point_scroll** (_event_): Triggered on scroll_to_index with fun(self, index, point) - **on_point_scroll** (_event_): fun(self: druid.scroll, index: number, point: vector3) Triggered on scroll_to_index
<a name="view_node"></a> <a name="view_node"></a>
- **view_node** (_node_): The scroll view node (static part) - **view_node** (_node_): The scroll view node (static part)

View File

@ -4,14 +4,6 @@
The component for manage the nodes position in the grid with various options The component for manage the nodes position in the grid with various options
## Functions
- [init](#init)# druid.grid API
> at /druid/base/static_grid.lua
The component for manage the nodes position in the grid with various options
## Functions ## Functions
- [init](#init) - [init](#init)
@ -346,398 +338,19 @@ Sort grid nodes by custom comparator function
## Fields ## Fields
<a name="on_add_item"></a> <a name="on_add_item"></a>
- **on_add_item** (_event_): Trigger on add item event, fun(self, item, index) - **on_add_item** (_event_): fun(self: druid.grid, item: node, index: number) Trigger on add item event
<a name="on_remove_item"></a> <a name="on_remove_item"></a>
- **on_remove_item** (_event_): Trigger on remove item event, fun(self, index) - **on_remove_item** (_event_): fun(self: druid.grid, index: number) Trigger on remove item event
<a name="on_change_items"></a> <a name="on_change_items"></a>
- **on_change_items** (_event_): Trigger on change items event, fun(self, index) - **on_change_items** (_event_): fun(self: druid.grid, index: number) Trigger on change items event
<a name="on_clear"></a> <a name="on_clear"></a>
- **on_clear** (_event_): Trigger on clear event, fun(self) - **on_clear** (_event_): fun(self: druid.grid) Trigger on clear event
<a name="on_update_positions"></a> <a name="on_update_positions"></a>
- **on_update_positions** (_event_): Trigger on update positions event, fun(self) - **on_update_positions** (_event_): fun(self: druid.grid) Trigger on update positions event
<a name="parent"></a>
- **parent** (_node_): Parent node
<a name="nodes"></a>
- **nodes** (_node[]_): Nodes array
<a name="first_index"></a>
- **first_index** (_number_): First index
<a name="last_index"></a>
- **last_index** (_number_): Last index
<a name="anchor"></a>
- **anchor** (_vector3_): Anchor
<a name="pivot"></a>
- **pivot** (_vector3_): Pivot
<a name="node_size"></a>
- **node_size** (_vector3_): Node size
<a name="border"></a>
- **border** (_vector4_): Border
<a name="in_row"></a>
- **in_row** (_number_): In row
<a name="style"></a>
- **style** (_druid.grid.style_): Style
<a name="node_pivot"></a>
- **node_pivot** (_unknown_)
- [get_pos](#get_pos)
- [get_index](#get_index)
- [get_index_by_node](#get_index_by_node)
- [set_anchor](#set_anchor)
- [refresh](#refresh)
- [set_pivot](#set_pivot)
- [add](#add)
- [set_items](#set_items)
- [remove](#remove)
- [get_size](#get_size)
- [get_size_for](#get_size_for)
- [get_borders](#get_borders)
- [get_all_pos](#get_all_pos)
- [set_position_function](#set_position_function)
- [clear](#clear)
- [get_offset](#get_offset)
- [set_in_row](#set_in_row)
- [set_item_size](#set_item_size)
- [sort_nodes](#sort_nodes)
## Fields
- [on_add_item](#on_add_item)
- [on_remove_item](#on_remove_item)
- [on_change_items](#on_change_items)
- [on_clear](#on_clear)
- [on_update_positions](#on_update_positions)
- [parent](#parent)
- [nodes](#nodes)
- [first_index](#first_index)
- [last_index](#last_index)
- [anchor](#anchor)
- [pivot](#pivot)
- [node_size](#node_size)
- [border](#border)
- [in_row](#in_row)
- [style](#style)
- [node_pivot](#node_pivot)
### init
---
```lua
grid:init(parent, element, [in_row])
```
The constructor for the grid component
- **Parameters:**
- `parent` *(string|node)*: The GUI Node container, where grid's items will be placed
- `element` *(node)*: Element prefab. Need to get it size
- `[in_row]` *(number|nil)*: How many nodes in row can be placed. By default 1
### get_pos
---
```lua
grid:get_pos(index)
```
Return pos for grid node index
- **Parameters:**
- `index` *(number)*: The grid element index
- **Returns:**
- `position` *(vector3)*: Node position
### get_index
---
```lua
grid:get_index(pos)
```
Return grid index by position
- **Parameters:**
- `pos` *(vector3)*: The node position in the grid
- **Returns:**
- `index` *(number)*: The node index
### get_index_by_node
---
```lua
grid:get_index_by_node(node)
```
Return grid index by node
- **Parameters:**
- `node` *(node)*: The gui node in the grid
- **Returns:**
- `index` *(number|nil)*: The node index
### set_anchor
---
```lua
grid:set_anchor(anchor)
```
Set grid anchor. Default anchor is equal to anchor of grid parent node
- **Parameters:**
- `anchor` *(vector3)*: Anchor
### refresh
---
```lua
grid:refresh()
```
Instantly update the grid content
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_pivot
---
```lua
grid:set_pivot(pivot)
```
Set grid pivot
- **Parameters:**
- `pivot` *(constant)*: The new pivot
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### add
---
```lua
grid:add(item, [index], [shift_policy], [is_instant])
```
Add new item to the grid
- **Parameters:**
- `item` *(node)*: GUI node
- `[index]` *(number|nil)*: The item position. By default add as last item
- `[shift_policy]` *(number|nil)*: How shift nodes, if required. Default: const.SHIFT.RIGHT
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_items
---
```lua
grid:set_items(nodes, [is_instant])
```
Set new items to the grid. All previous items will be removed
- **Parameters:**
- `nodes` *(node[])*: The new grid nodes
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### remove
---
```lua
grid:remove(index, [shift_policy], [is_instant])
```
Remove the item from the grid. Note that gui node will be not deleted
- **Parameters:**
- `index` *(number)*: The grid node index to remove
- `[shift_policy]` *(number|nil)*: How shift nodes, if required. Default: const.SHIFT.RIGHT
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `node` *(node)*: The deleted gui node from grid
### get_size
---
```lua
grid:get_size()
```
Return grid content size
- **Returns:**
- `size` *(vector3)*: The grid content size
### get_size_for
---
```lua
grid:get_size_for(count)
```
Return grid content size for given count of nodes
- **Parameters:**
- `count` *(number)*: The count of nodes
- **Returns:**
- `size` *(vector3)*: The grid content size
### get_borders
---
```lua
grid:get_borders()
```
Return grid content borders
- **Returns:**
- `borders` *(vector4)*: The grid content borders
### get_all_pos
---
```lua
grid:get_all_pos()
```
Return array of all node positions
- **Returns:**
- `positions` *(vector3[])*: All grid node positions
### set_position_function
---
```lua
grid:set_position_function(callback)
```
Change set position function for grid nodes. It will call on
update poses on grid elements. Default: gui.set_position
- **Parameters:**
- `callback` *(function)*: Function on node set position
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### clear
---
```lua
grid:clear()
```
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
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### get_offset
---
```lua
grid:get_offset()
```
Return StaticGrid offset, where StaticGrid content starts.
- **Returns:**
- `offset` *(vector3)*: The StaticGrid offset
### set_in_row
---
```lua
grid:set_in_row(in_row)
```
Set new in_row elements for grid
- **Parameters:**
- `in_row` *(number)*: The new in_row value
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_item_size
---
```lua
grid:set_item_size([width], [height])
```
Set new node size for grid
- **Parameters:**
- `[width]` *(number|nil)*: The new node width
- `[height]` *(number|nil)*: The new node height
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### sort_nodes
---
```lua
grid:sort_nodes(comparator)
```
Sort grid nodes by custom comparator function
- **Parameters:**
- `comparator` *(function)*: The comparator function. (a, b) -> boolean
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
## Fields
<a name="on_add_item"></a>
- **on_add_item** (_event_): Trigger on add item event, fun(self, item, index)
<a name="on_remove_item"></a>
- **on_remove_item** (_event_): Trigger on remove item event, fun(self, index)
<a name="on_change_items"></a>
- **on_change_items** (_event_): Trigger on change items event, fun(self, index)
<a name="on_clear"></a>
- **on_clear** (_event_): Trigger on clear event, fun(self)
<a name="on_update_positions"></a>
- **on_update_positions** (_event_): Trigger on update positions event, fun(self)
<a name="parent"></a> <a name="parent"></a>
- **parent** (_node_): Parent node - **parent** (_node_): Parent node

View File

@ -46,6 +46,9 @@ Create text node with druid: `text = druid:new_text(node_name, [initial_value],
- [on_update_text_scale](#on_update_text_scale) - [on_update_text_scale](#on_update_text_scale)
- [on_set_pivot](#on_set_pivot) - [on_set_pivot](#on_set_pivot)
- [style](#style) - [style](#style)
- [start_pivot](#start_pivot)
- [start_scale](#start_scale)
- [scale](#scale)
- [pos](#pos) - [pos](#pos)
- [node_id](#node_id) - [node_id](#node_id)
- [start_size](#start_size) - [start_size](#start_size)
@ -300,17 +303,26 @@ Return current text adjust type
- **node** (_node_): The text node - **node** (_node_): The text node
<a name="on_set_text"></a> <a name="on_set_text"></a>
- **on_set_text** (_event_): fun(self, text) The event triggered when the text is set - **on_set_text** (_event_): fun(self: druid.text, text: string) The event triggered when the text is set
<a name="on_update_text_scale"></a> <a name="on_update_text_scale"></a>
- **on_update_text_scale** (_event_): fun(self, scale, metrics) The event triggered when the text scale is updated - **on_update_text_scale** (_event_): fun(self: druid.text, scale: vector3, metrics: table) The event triggered when the text scale is updated
<a name="on_set_pivot"></a> <a name="on_set_pivot"></a>
- **on_set_pivot** (_event_): fun(self, pivot) The event triggered when the text pivot is set - **on_set_pivot** (_event_): fun(self: druid.text, pivot: userdata) The event triggered when the text pivot is set
<a name="style"></a> <a name="style"></a>
- **style** (_druid.text.style_): The style of the text - **style** (_druid.text.style_): The style of the text
<a name="start_pivot"></a>
- **start_pivot** (_userdata_): The start pivot of the text
<a name="start_scale"></a>
- **start_scale** (_vector3_): The start scale of the text
<a name="scale"></a>
- **scale** (_vector3_): The current scale of the text
<a name="pos"></a> <a name="pos"></a>
- **pos** (_unknown_) - **pos** (_unknown_)

View File

@ -238,9 +238,6 @@ container:set_parent_container([parent_container])
container:refresh() container:refresh()
``` ```
Glossary
Center Offset - vector from node position to visual center of node
### refresh_scale ### refresh_scale
--- ---

View File

@ -220,13 +220,13 @@ Instant scroll to element with passed index
- **grid** (_druid.grid_): The StaticGrid or DynamicGrid instance for Data List component - **grid** (_druid.grid_): The StaticGrid or DynamicGrid instance for Data List component
<a name="on_scroll_progress_change"></a> <a name="on_scroll_progress_change"></a>
- **on_scroll_progress_change** (_event_): The event triggered when the scroll progress changes - **on_scroll_progress_change** (_event_): fun(self: druid.data_list, progress: number) The event triggered when the scroll progress changes
<a name="on_element_add"></a> <a name="on_element_add"></a>
- **on_element_add** (_event_): The event triggered when a new element is added - **on_element_add** (_event_): fun(self: druid.data_list, index: number, node: node, instance: druid.component, data: table) The event triggered when a new element is added
<a name="on_element_remove"></a> <a name="on_element_remove"></a>
- **on_element_remove** (_event_): The event triggered when an element is removed - **on_element_remove** (_event_): fun(self: druid.data_list, index: number, node: node, instance: druid.component, data: table) The event triggered when an element is removed
<a name="top_index"></a> <a name="top_index"></a>
- **top_index** (_number_): The top index of the visible elements - **top_index** (_number_): The top index of the visible elements

View File

@ -115,7 +115,7 @@ Format string with new text params on localized text. Keeps the current locale b
- **node** (_node_): The node of the text component - **node** (_node_): The node of the text component
<a name="on_change"></a> <a name="on_change"></a>
- **on_change** (_event_): The event triggered when the text is changed - **on_change** (_event_): fun(self: druid.lang_text) The event triggered when the text is changed
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components - **druid** (_druid.instance_): The Druid Factory used to create components

View File

@ -337,7 +337,7 @@ layout:set_node_position(node, x, y)
- **is_justify** (_boolean_): True if the layout should justify the nodes - **is_justify** (_boolean_): True if the layout should justify the nodes
<a name="on_size_changed"></a> <a name="on_size_changed"></a>
- **on_size_changed** (_event.on_size_changed_): The event triggered when the size of the layout is changed - **on_size_changed** (_event.on_size_changed_): fun(self: druid.layout, size: vector3) The event triggered when the size of the layout is changed
<a name="size"></a> <a name="size"></a>
- **size** (_unknown_) - **size** (_unknown_)

View File

@ -8,10 +8,10 @@ Basic Druid progress bar component. Changes the size or scale of a node to repre
Create progress bar component with druid: `progress = druid:new_progress(node_name, key, init_value)` Create progress bar component with druid: `progress = druid:new_progress(node_name, key, init_value)`
### Notes ### Notes
- Node should have maximum node size in GUI scene, it's represent the progress bar maximum size - Node should have maximum node size in GUI scene, it represents the progress bar's maximum size
- Key is value from druid const: "x" or "y" - Key is value from druid const: "x" or "y"
- Progress works correctly with 9slice nodes, it tries to set size by _set_size_ first, until minimum size is reached, then it sizing via _set_scale_ - Progress works correctly with 9slice nodes, it tries to set size by _set_size_ first until minimum size is reached, then it continues sizing via _set_scale_
- Progress bar can fill only by vertical or horizontal size. For diagonal progress bar, just rotate node in GUI scene - Progress bar can fill only by vertical or horizontal size. For diagonal progress bar, just rotate the node in GUI scene
- If you have glitchy or dark texture bugs with progress bar, try to disable mipmaps in your texture profiles - If you have glitchy or dark texture bugs with progress bar, try to disable mipmaps in your texture profiles
## Functions ## Functions
@ -172,7 +172,7 @@ Set progress bar max node size
- **node** (_node_): The progress bar node - **node** (_node_): The progress bar node
<a name="on_change"></a> <a name="on_change"></a>
- **on_change** (_event_): Event triggered when progress value changes - **on_change** (_event_): fun(self: druid.progress, value: number) Event triggered when progress value changes
<a name="style"></a> <a name="style"></a>
- **style** (_druid.progress.style_): Component style parameters - **style** (_druid.progress.style_): Component style parameters

View File

@ -128,7 +128,7 @@ Check if Slider component is enabled
- **node** (_node_): The node to manage the slider - **node** (_node_): The node to manage the slider
<a name="on_change_value"></a> <a name="on_change_value"></a>
- **on_change_value** (_event_): The event triggered when the slider value changes - **on_change_value** (_event_): fun(self: druid.slider, value: number) The event triggered when the slider value changes
<a name="style"></a> <a name="style"></a>
- **style** (_table_): The style of the slider - **style** (_table_): The style of the slider

View File

@ -11,8 +11,8 @@ local component = require("druid.component")
---- Key triggers in `input.binding` should be setup for correct working ---- Key triggers in `input.binding` should be setup for correct working
---- It uses a key_back and key_backspace action ids ---- It uses a key_back and key_backspace action ids
---@class druid.back_handler: druid.component ---@class druid.back_handler: druid.component
---@field on_back event Trigger on back handler action, fun(self, params) ---@field on_back event fun(self: druid.back_handler, params: any?) Trigger on back handler action
---@field params any|nil Custom args to pass in the callback ---@field params any? Custom args to pass in the callback
local M = component.create("back_handler") local M = component.create("back_handler")

View File

@ -32,13 +32,13 @@ local component = require("druid.component")
---- Button can have key trigger to use them by key: `button:set_key_trigger` ---- Button can have key trigger to use them by key: `button:set_key_trigger`
---- ----
---@class druid.button: druid.component ---@class druid.button: druid.component
---@field on_click event function(self, custom_args, button_instance) ---@field on_click event fun(self, custom_args, button_instance)
---@field on_pressed event function(self, custom_args, button_instance) ---@field on_pressed event fun(self, custom_args, button_instance)
---@field on_repeated_click event function(self, custom_args, button_instance, click_count) Repeated click callback, while holding the button ---@field on_repeated_click event fun(self, custom_args, button_instance, click_count) Repeated click callback, while holding the button
---@field on_long_click event function(self, custom_args, button_instance, hold_time) Callback on long button tap ---@field on_long_click event fun(self, custom_args, button_instance, hold_time) Callback on long button tap
---@field on_double_click event function(self, custom_args, button_instance, click_amount) Different callback, if tap button 2+ in row ---@field on_double_click event fun(self, custom_args, button_instance, click_amount) Different callback, if tap button 2+ in row
---@field on_hold_callback event function(self, custom_args, button_instance, press_time) Hold callback, before long_click trigger ---@field on_hold_callback event fun(self, custom_args, button_instance, press_time) Hold callback, before long_click trigger
---@field on_click_outside event function(self, custom_args, button_instance) ---@field on_click_outside event fun(self, custom_args, button_instance)
---@field node node Clickable node ---@field node node Clickable node
---@field node_id hash Node id ---@field node_id hash Node id
---@field anim_node node Animation node. In default case equals to clickable node ---@field anim_node node Animation node. In default case equals to clickable node

View File

@ -38,9 +38,9 @@ local component = require("druid.component")
---@class druid.scroll: druid.component ---@class druid.scroll: druid.component
---@field node node The root node ---@field node node The root node
---@field click_zone node|nil Optional click zone to restrict scroll area ---@field click_zone node|nil Optional click zone to restrict scroll area
---@field on_scroll event Triggered on scroll move with fun(self, position) ---@field on_scroll event fun(self: druid.scroll, position: vector3) Triggered on scroll move
---@field on_scroll_to event Triggered on scroll_to with fun(self, target, is_instant) ---@field on_scroll_to event fun(self: druid.scroll, target: vector3, is_instant: boolean) Triggered on scroll_to
---@field on_point_scroll event Triggered on scroll_to_index with fun(self, index, point) ---@field on_point_scroll event fun(self: druid.scroll, index: number, point: vector3) Triggered on scroll_to_index
---@field view_node node The scroll view node (static part) ---@field view_node node The scroll view node (static part)
---@field view_border vector4 The scroll view borders ---@field view_border vector4 The scroll view borders
---@field content_node node The scroll content node (moving part) ---@field content_node node The scroll content node (moving part)

View File

@ -9,11 +9,11 @@ local component = require("druid.component")
---The component for manage the nodes position in the grid with various options ---The component for manage the nodes position in the grid with various options
---@class druid.grid: druid.component ---@class druid.grid: druid.component
---@field on_add_item event Trigger on add item event, fun(self, item, index) ---@field on_add_item event fun(self: druid.grid, item: node, index: number) Trigger on add item event
---@field on_remove_item event Trigger on remove item event, fun(self, index) ---@field on_remove_item event fun(self: druid.grid, index: number) Trigger on remove item event
---@field on_change_items event Trigger on change items event, fun(self, index) ---@field on_change_items event fun(self: druid.grid, index: number) Trigger on change items event
---@field on_clear event Trigger on clear event, fun(self) ---@field on_clear event fun(self: druid.grid) Trigger on clear event
---@field on_update_positions event Trigger on update positions event, fun(self) ---@field on_update_positions event fun(self: druid.grid) Trigger on update positions event
---@field parent node Parent node ---@field parent node Parent node
---@field nodes node[] Nodes array ---@field nodes node[] Nodes array
---@field first_index number First index ---@field first_index number First index

View File

@ -33,9 +33,9 @@ local utf8 = utf8 or utf8_lua --[[@as utf8]]
---- - **"scale_then_trim_left"** - Combine two modes: first limited downscale, then trim left ---- - **"scale_then_trim_left"** - Combine two modes: first limited downscale, then trim left
---@class druid.text: druid.component ---@class druid.text: druid.component
---@field node node The text node ---@field node node The text node
---@field on_set_text event fun(self, text) The event triggered when the text is set ---@field on_set_text event fun(self: druid.text, text: string) The event triggered when the text is set
---@field on_update_text_scale event fun(self, scale, metrics) The event triggered when the text scale is updated ---@field on_update_text_scale event fun(self: druid.text, scale: vector3, metrics: table) The event triggered when the text scale is updated
---@field on_set_pivot event fun(self, pivot) The event triggered when the text pivot is set ---@field on_set_pivot event fun(self: druid.text, pivot: userdata) The event triggered when the text pivot is set
---@field style druid.text.style The style of the text ---@field style druid.text.style The style of the text
---@field start_pivot userdata The start pivot of the text ---@field start_pivot userdata The start pivot of the text
---@field start_scale vector3 The start scale of the text ---@field start_scale vector3 The start scale of the text

View File

@ -18,9 +18,9 @@ local event = require("event.event")
---@class druid.data_list: druid.component ---@class druid.data_list: druid.component
---@field scroll druid.scroll The scroll instance for Data List component ---@field scroll druid.scroll The scroll instance for Data List component
---@field grid druid.grid The StaticGrid or DynamicGrid instance for Data List component ---@field grid druid.grid The StaticGrid or DynamicGrid instance for Data List component
---@field on_scroll_progress_change event The event triggered when the scroll progress changes ---@field on_scroll_progress_change event fun(self: druid.data_list, progress: number) The event triggered when the scroll progress changes
---@field on_element_add event The event triggered when a new element is added ---@field on_element_add event fun(self: druid.data_list, index: number, node: node, instance: druid.component, data: table) The event triggered when a new element is added
---@field on_element_remove event The event triggered when an element is removed ---@field on_element_remove event fun(self: druid.data_list, index: number, node: node, instance: druid.component, data: table) The event triggered when an element is removed
---@field top_index number The top index of the visible elements ---@field top_index number The top index of the visible elements
---@field last_index number The last index of the visible elements ---@field last_index number The last index of the visible elements
---@field scroll_progress number The scroll progress ---@field scroll_progress number The scroll progress

View File

@ -15,7 +15,7 @@ local settings = require("druid.system.settings")
---@class druid.lang_text: druid.component ---@class druid.lang_text: druid.component
---@field text druid.text The text component ---@field text druid.text The text component
---@field node node The node of the text component ---@field node node The node of the text component
---@field on_change event The event triggered when the text is changed ---@field on_change event fun(self: druid.lang_text) The event triggered when the text is changed
---@field private last_locale_args table The last locale arguments ---@field private last_locale_args table The last locale arguments
---@field private last_locale string The last locale ---@field private last_locale string The last locale
local M = component.create("lang_text") local M = component.create("lang_text")

View File

@ -42,7 +42,7 @@ local component = require("druid.component")
---@field is_resize_width boolean True if the layout should resize the width of the node ---@field is_resize_width boolean True if the layout should resize the width of the node
---@field is_resize_height boolean True if the layout should resize the height of the node ---@field is_resize_height boolean True if the layout should resize the height of the node
---@field is_justify boolean True if the layout should justify the nodes ---@field is_justify boolean True if the layout should justify the nodes
---@field on_size_changed event.on_size_changed The event triggered when the size of the layout is changed ---@field on_size_changed event.on_size_changed fun(self: druid.layout, size: vector3) The event triggered when the size of the layout is changed
local M = component.create("layout") local M = component.create("layout")

View File

@ -19,7 +19,7 @@ local component = require("druid.component")
---- If you have glitchy or dark texture bugs with progress bar, try to disable mipmaps in your texture profiles ---- If you have glitchy or dark texture bugs with progress bar, try to disable mipmaps in your texture profiles
---@class druid.progress: druid.component ---@class druid.progress: druid.component
---@field node node The progress bar node ---@field node node The progress bar node
---@field on_change event Event triggered when progress value changes ---@field on_change event fun(self: druid.progress, value: number) Event triggered when progress value changes
---@field style druid.progress.style Component style parameters ---@field style druid.progress.style Component style parameters
---@field key string Progress bar direction: "x" or "y" ---@field key string Progress bar direction: "x" or "y"
---@field prop hash Property for scaling the progress bar ---@field prop hash Property for scaling the progress bar

View File

@ -16,7 +16,7 @@ local component = require("druid.component")
---- To catch input across all slider, you can setup input node via `slider:set_input_node` ---- To catch input across all slider, you can setup input node via `slider:set_input_node`
---@class druid.slider: druid.component ---@class druid.slider: druid.component
---@field node node The node to manage the slider ---@field node node The node to manage the slider
---@field on_change_value event The event triggered when the slider value changes ---@field on_change_value event fun(self: druid.slider, value: number) The event triggered when the slider value changes
---@field style table The style of the slider ---@field style table The style of the slider
---@field private start_pos vector3 The start position of the slider ---@field private start_pos vector3 The start position of the slider
---@field private pos vector3 The current position of the slider ---@field private pos vector3 The current position of the slider

View File

@ -14,7 +14,7 @@ update_frequency = 60
[project] [project]
title = Druid title = Druid
version = 1.1 version = 1.1.0
publisher = Insality publisher = Insality
developer = Maksim Tuprikov developer = Maksim Tuprikov
custom_resources = /example/locales custom_resources = /example/locales

View File

@ -577,13 +577,13 @@ Please support me if you like this project! It will help me keep engaged to upda
### Druid 1.1 ### Druid 1.1.0
Hello there, Druid users! Hello there, Druid users!
The wait is over - **Druid 1.1** has arrived! This update brings substantial improvements and exciting new features that make building UI in Defold easier and more powerful than ever. The wait is over - **Druid 1.1** has arrived! This update brings substantial improvements and exciting new features that make building UI in Defold easier and more powerful than ever.
By the way, the PR number of this release is #300. Sounds veeery hude and long journey for me! By the way, the PR number of this release is #300. Sounds veeery huge and long journey for me!
## Highlights ## Highlights
@ -619,7 +619,7 @@ Thank you for using Druid and please share your feedback!
**Milestone**: **Milestone**:
**Changelog 1.1** **Changelog 1.1.0**
- [Docs] Reworked all documentation pages - [Docs] Reworked all documentation pages
- The code now is fully annotated - The code now is fully annotated
- The old API website is removed - The old API website is removed