Reimport docs

This commit is contained in:
Insality
2025-03-18 22:00:51 +02:00
parent 3c063313de
commit 44b735adda
31 changed files with 617 additions and 869 deletions

View File

@@ -2,14 +2,13 @@
> at /druid/extended/container.lua
The component used for managing the size and positions with other containers relations to create a adaptable layouts
## Functions
- [init](#init)
- [on_late_init](#on_late_init)
- [on_remove](#on_remove)
- [refresh_origins](#refresh_origins)
- [set_pivot](#set_pivot)
- [on_style_change](#on_style_change)
- [set_size](#set_size)
- [get_position](#get_position)
- [set_position](#set_position)
@@ -17,7 +16,6 @@
- [get_scale](#get_scale)
- [fit_into_size](#fit_into_size)
- [fit_into_window](#fit_into_window)
- [on_window_resized](#on_window_resized)
- [add_container](#add_container)
- [remove_container_by_node](#remove_container_by_node)
- [set_parent_container](#set_parent_container)
@@ -67,20 +65,6 @@ container:init(node, mode, [callback])
- `mode` *(string)*: Layout mode
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
### on_late_init
---
```lua
container:on_late_init()
```
### on_remove
---
```lua
container:on_remove()
```
### refresh_origins
---
@@ -88,6 +72,8 @@ container:on_remove()
container:refresh_origins()
```
Refresh the origins of the container, origins is the size and position of the container when it was created
### set_pivot
---
@@ -95,18 +81,10 @@ container:refresh_origins()
container:set_pivot(pivot)
```
- **Parameters:**
- `pivot` *(constant)*:
### on_style_change
---
```lua
container:on_style_change(style)
```
Set the pivot of the container
- **Parameters:**
- `style` *(druid.container.style)*:
- `pivot` *(constant)*: The pivot to set
### set_size
@@ -118,8 +96,8 @@ container:set_size([width], [height], [anchor_pivot])
Set new size of layout node
- **Parameters:**
- `[width]` *(number|nil)*:
- `[height]` *(number|nil)*:
- `[width]` *(number|nil)*: The width to set
- `[height]` *(number|nil)*: The height to set
- `[anchor_pivot]` *(constant|nil)*: If set will keep the corner possition relative to the new size
- **Returns:**
@@ -132,8 +110,10 @@ Set new size of layout node
container:get_position()
```
Get the position of the container
- **Returns:**
- `` *(unknown)*:
- `position` *(vector3)*: The position of the container
### set_position
@@ -142,9 +122,11 @@ container:get_position()
container:set_position(pos_x, pos_y)
```
Set the position of the container
- **Parameters:**
- `pos_x` *(number)*:
- `pos_y` *(number)*:
- `pos_x` *(number)*: The x position to set
- `pos_y` *(number)*: The y position to set
### get_size
@@ -153,10 +135,10 @@ container:set_position(pos_x, pos_y)
container:get_size()
```
Get current size of layout node
Get the current size of the layout node
- **Returns:**
- `size` *(vector3)*:
- `size` *(vector3)*: The current size of the layout node
### get_scale
@@ -165,10 +147,10 @@ Get current size of layout node
container:get_scale()
```
Get current scale of layout node
Get the current scale of the layout node
- **Returns:**
- `scale` *(vector3)*:
- `scale` *(vector3)*: The current scale of the layout node
### fit_into_size
@@ -180,10 +162,10 @@ container:fit_into_size(target_size)
Set size for layout node to fit inside it
- **Parameters:**
- `target_size` *(vector3)*:
- `target_size` *(vector3)*: The target size to fit into
- **Returns:**
- `Container` *(druid.container)*:
- `self` *(druid.container)*: Current container instance
### fit_into_window
@@ -195,14 +177,7 @@ container:fit_into_window()
Set current size for layout node to fit inside it
- **Returns:**
- `Container` *(druid.container)*:
### on_window_resized
---
```lua
container:on_window_resized()
```
- `self` *(druid.container)*: Current container instance
### add_container
@@ -212,7 +187,7 @@ container:add_container(node_or_container, [mode], [on_resize_callback])
```
- **Parameters:**
- `node_or_container` *(string|table|druid.container|node)*:
- `node_or_container` *(string|table|druid.container|node)*: The component used for managing the size and positions with other containers relations to create a adaptable layouts
- `[mode]` *(string|nil)*: stretch, fit, stretch_x, stretch_y. Default: Pick from node, "fit" or "stretch"
- `[on_resize_callback]` *(fun(self: userdata, size: vector3)|nil)*:
@@ -240,7 +215,7 @@ container:set_parent_container([parent_container])
```
- **Parameters:**
- `[parent_container]` *(druid.container|nil)*:
- `[parent_container]` *(druid.container|nil)*: The component used for managing the size and positions with other containers relations to create a adaptable layouts
### refresh
@@ -274,7 +249,7 @@ container:create_draggable_corners()
```
- **Returns:**
- `Container` *(druid.container)*:
- `self` *(druid.container)*: Current container instance
### clear_draggable_corners
@@ -284,7 +259,7 @@ container:clear_draggable_corners()
```
- **Returns:**
- `Container` *(druid.container)*:
- `self` *(druid.container)*: Current container instance
### fit_into_node
@@ -299,7 +274,7 @@ Set node for layout node to fit inside it. Pass nil to reset
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:**
- `Layout` *(druid.container)*:
- `self` *(druid.container)*: Current container instance
### set_min_size
@@ -308,56 +283,58 @@ Set node for layout node to fit inside it. Pass nil to reset
container:set_min_size([min_size_x], [min_size_y])
```
Set the minimum size of the container
- **Parameters:**
- `[min_size_x]` *(number|nil)*:
- `[min_size_y]` *(number|nil)*:
- `[min_size_x]` *(number|nil)*: The minimum size x
- `[min_size_y]` *(number|nil)*: The minimum size y
- **Returns:**
- `` *(druid.container)*:
- `self` *(druid.container)*: Current container instance
## Fields
<a name="node"></a>
- **node** (_node_)
- **node** (_node_): The gui node
<a name="druid"></a>
- **druid** (_druid.instance_)
- **druid** (_druid.instance_): The druid instance
<a name="node_offset"></a>
- **node_offset** (_vector4_)
- **node_offset** (_vector4_): The node offset
<a name="origin_size"></a>
- **origin_size** (_vector3_)
- **origin_size** (_vector3_): The origin size
<a name="size"></a>
- **size** (_vector3_)
- **size** (_vector3_): The current size
<a name="origin_position"></a>
- **origin_position** (_vector3_)
- **origin_position** (_vector3_): The origin position
<a name="position"></a>
- **position** (_vector3_)
- **position** (_vector3_): The current position
<a name="pivot_offset"></a>
- **pivot_offset** (_vector3_)
- **pivot_offset** (_vector3_): The pivot offset
<a name="center_offset"></a>
- **center_offset** (_vector3_)
- **center_offset** (_vector3_): The center offset
<a name="mode"></a>
- **mode** (_string_)
- **mode** (_string_): The layout mode
<a name="fit_size"></a>
- **fit_size** (_vector3_)
- **fit_size** (_vector3_): The fit size
<a name="min_size_x"></a>
- **min_size_x** (_number_)
- **min_size_x** (_number_): The minimum size x
<a name="min_size_y"></a>
- **min_size_y** (_number_)
- **min_size_y** (_number_): The minimum size y
<a name="on_size_changed"></a>
- **on_size_changed** (_event_): fun(self: druid.container, size: vector3)
- **on_size_changed** (_event_): fun(self: druid.container, size: vector3) The event triggered when the size changes
<a name="node_fill_x"></a>
- **node_fill_x** (_nil_)

View File

@@ -2,6 +2,8 @@
> at /druid/extended/data_list.lua
The component used for managing a list of data with a scrollable view, used to manage huge list data and render only visible elements
## Functions
- [init](#init)
@@ -40,7 +42,7 @@ data_list:init(scroll, grid, create_function)
- **Parameters:**
- `scroll` *(druid.scroll)*: The Scroll instance for Data List component
- `grid` *(druid.grid)*: The StaticGrid} or @{DynamicGrid instance for Data List component
- `grid` *(druid.grid)*: The StaticGrid instance for Data List component
- `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
### on_remove
@@ -59,13 +61,13 @@ Druid System on_remove function
data_list:set_use_cache(is_use_cache)
```
Set refresh function for DataList component
Set use cache version of DataList. Requires make setup of components in on_element_add callback and clean in on_element_remove
- **Parameters:**
- `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
- `is_use_cache` *(boolean)*: Use cache version of DataList
- **Returns:**
- `Current` *(druid.data_list)*: DataList instance
- `self` *(druid.data_list)*: Current DataList instance
### set_data
@@ -80,7 +82,7 @@ Set new data set for DataList component
- `data` *(table)*: The new data array
- **Returns:**
- `Current` *(druid.data_list)*: DataList instance
- `self` *(druid.data_list)*: Current DataList instance
### get_data
@@ -92,7 +94,7 @@ data_list:get_data()
Return current data from DataList component
- **Returns:**
- `The` *(table)*: current data array
- `data` *(table)*: The current data array
### add
@@ -101,13 +103,16 @@ Return current data from DataList component
data_list:add(data, [index], [shift_policy])
```
Add element to DataList. Currenly untested
Add element to DataList
- **Parameters:**
- `data` *(table)*:
- `[index]` *(number|nil)*:
- `data` *(table)*: The data to add
- `[index]` *(number|nil)*: The index to add the data at
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### remove
---
@@ -115,12 +120,15 @@ Add element to DataList. Currenly untested
data_list:remove([index], [shift_policy])
```
Remove element from DataList. Currenly untested
Remove element from DataList
- **Parameters:**
- `[index]` *(number|nil)*:
- `[index]` *(number|nil)*: The index to remove the data at
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### remove_by_data
---
@@ -128,12 +136,15 @@ Remove element from DataList. Currenly untested
data_list:remove_by_data(data, [shift_policy])
```
Remove element from DataList by data value. Currenly untested
Remove element from DataList by data value
- **Parameters:**
- `data` *(table)*:
- `data` *(table)*: The data to remove
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### clear
---
@@ -143,6 +154,9 @@ data_list:clear()
Clear the DataList and refresh visuals
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### get_index
---
@@ -180,7 +194,7 @@ data_list:get_created_components()
Return all currenly created components in DataList
- **Returns:**
- `List` *(druid.component[])*: of created nodes
- `components` *(druid.component[])*: List of created components
### scroll_to_index
@@ -192,31 +206,31 @@ data_list:scroll_to_index(index)
Instant scroll to element with passed index
- **Parameters:**
- `index` *(number)*:
- `index` *(number)*: The index to scroll to
## Fields
<a name="scroll"></a>
- **scroll** (_druid.scroll_)
- **scroll** (_druid.scroll_): The scroll instance for Data List component
<a name="grid"></a>
- **grid** (_druid.grid_)
- **grid** (_druid.grid_): The StaticGrid or DynamicGrid instance for Data List component
<a name="on_scroll_progress_change"></a>
- **on_scroll_progress_change** (_event_)
- **on_scroll_progress_change** (_event_): The event triggered when the scroll progress changes
<a name="on_element_add"></a>
- **on_element_add** (_event_)
- **on_element_add** (_event_): The event triggered when a new element is added
<a name="on_element_remove"></a>
- **on_element_remove** (_event_)
- **on_element_remove** (_event_): The event triggered when an element is removed
<a name="top_index"></a>
- **top_index** (_number_)
- **top_index** (_number_): The top index of the visible elements
<a name="last_index"></a>
- **last_index** (_number_)
- **last_index** (_number_): The last index of the visible elements
<a name="scroll_progress"></a>
- **scroll_progress** (_number_)
- **scroll_progress** (_number_): The scroll progress

View File

@@ -2,6 +2,8 @@
> at /druid/extended/hotkey.lua
The component used for managing hotkeys and trigger callbacks when hotkeys are pressed
## Functions
- [init](#init)
@@ -59,7 +61,7 @@ Add hotkey for component callback
- `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:**
- `Current` *(druid.hotkey)*: instance
- `self` *(druid.hotkey)*: Current instance
### is_processing
@@ -86,11 +88,11 @@ hotkey:on_input([action_id], action)
```
- **Parameters:**
- `[action_id]` *(hash|nil)*:
- `action` *(action)*:
- `[action_id]` *(hash|nil)*: The action id
- `action` *(action)*: The action
- **Returns:**
- `` *(boolean)*:
- `is_consume` *(boolean)*: True if the action is consumed
### set_repeat
@@ -102,22 +104,22 @@ hotkey:set_repeat(is_enabled_repeated)
If true, the callback will be triggered on action.repeated
- **Parameters:**
- `is_enabled_repeated` *(bool)*: The flag value
- `is_enabled_repeated` *(boolean)*: The flag value
- **Returns:**
- `` *(druid.hotkey)*:
- `self` *(druid.hotkey)*: Current instance
## Fields
<a name="on_hotkey_pressed"></a>
- **on_hotkey_pressed** (_event_)
- **on_hotkey_pressed** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is pressed
<a name="on_hotkey_released"></a>
- **on_hotkey_released** (_event_)
- **on_hotkey_released** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is released
<a name="style"></a>
- **style** (_druid.hotkey.style_)
- **style** (_druid.hotkey.style_): The style of the hotkey component
<a name="druid"></a>
- **druid** (_druid.instance_)
- **druid** (_druid.instance_): The Druid Factory used to create components

View File

@@ -2,11 +2,11 @@
> at /druid/extended/input.lua
The component used for managing input fields in basic way
## Functions
- [init](#init)
- [on_style_change](#on_style_change)
- [on_input](#on_input)
- [on_focus_lost](#on_focus_lost)
- [on_input_interrupt](#on_input_interrupt)
- [get_text_selected](#get_text_selected)
@@ -66,30 +66,6 @@ input:init(click_node, text_node, [keyboard_type])
- `text_node` *(druid.text|node)*: Text node what will be changed on user input. You can pass text component instead of text node name Text
- `[keyboard_type]` *(number|nil)*: Gui keyboard type for input field
### on_style_change
---
```lua
input:on_style_change(style)
```
- **Parameters:**
- `style` *(druid.input.style)*:
### on_input
---
```lua
input:on_input([action_id], [action])
```
- **Parameters:**
- `[action_id]` *(any)*:
- `[action]` *(any)*:
- **Returns:**
- `` *(boolean)*:
### on_focus_lost
---
@@ -127,7 +103,7 @@ Replace selected text with new text
- `text` *(string)*: The text to replace selected text
- **Returns:**
- `New` *(string)*: input text
- `new_text` *(string)*: New input text
### set_text
@@ -169,7 +145,7 @@ input:get_text()
Return current input field text
- **Returns:**
- `The` *(string)*: current input field text
- `text` *(string)*: The current input field text
### set_max_length
@@ -185,7 +161,7 @@ Set maximum length for input field.
- `max_length` *(number)*: Maximum length for input text field
- **Returns:**
- `Current` *(druid.input)*: input instance
- `self` *(druid.input)*: Current input instance
### set_allowed_characters
@@ -202,7 +178,7 @@ Set allowed charaters for input field.
- `characters` *(string)*: Regulax exp. for validate user input
- **Returns:**
- `Current` *(druid.input)*: input instance
- `self` *(druid.input)*: Current input instance
### reset_changes
@@ -214,7 +190,7 @@ input:reset_changes()
Reset current input selection and return previous value
- **Returns:**
- `Current` *(druid.input)*: input instance
- `self` *(druid.input)*: Current input instance
### select_cursor
@@ -231,7 +207,7 @@ Set cursor position in input field
- `[end_index]` *(number|nil)*: End index for cursor position, if nil - will be set to the start_index
- **Returns:**
- `Current` *(druid.input)*: input instance
- `self` *(druid.input)*: Current input instance
### move_selection
@@ -247,40 +223,43 @@ Change cursor position by delta
- `is_add_to_selection` *(boolean)*: (Shift key)
- `is_move_to_end` *(boolean)*: (Ctrl key)
- **Returns:**
- `self` *(druid.input)*: Current input instance
## Fields
<a name="on_input_select"></a>
- **on_input_select** (_event_)
- **on_input_select** (_event_): fun(self: druid.input, input: druid.input) The event triggered when the input field is selected
<a name="on_input_unselect"></a>
- **on_input_unselect** (_event_)
- **on_input_unselect** (_event_): fun(self: druid.input, text: string, input: druid.input) The event triggered when the input field is unselected
<a name="on_input_text"></a>
- **on_input_text** (_event_)
- **on_input_text** (_event_): fun(self: druid.input) The event triggered when the input field is changed
<a name="on_input_empty"></a>
- **on_input_empty** (_event_)
- **on_input_empty** (_event_): fun(self: druid.input) The event triggered when the input field is empty
<a name="on_input_full"></a>
- **on_input_full** (_event_)
- **on_input_full** (_event_): fun(self: druid.input) The event triggered when the input field is full
<a name="on_input_wrong"></a>
- **on_input_wrong** (_event_)
- **on_input_wrong** (_event_): fun(self: druid.input) The event triggered when the input field is wrong
<a name="on_select_cursor_change"></a>
- **on_select_cursor_change** (_event_)
- **on_select_cursor_change** (_event_): fun(self: druid.input, cursor_index: number, start_index: number, end_index: number) The event triggered when the cursor index is changed
<a name="style"></a>
- **style** (_table_)
- **style** (_druid.input.style_): The style of the input component
<a name="text"></a>
- **text** (_druid.text_)
- **text** (_druid.text_): The text component
<a name="ALLOWED_ACTIONS"></a>
- **ALLOWED_ACTIONS** (_table_)
<a name="druid"></a>
- **druid** (_druid.instance_)
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="is_selected"></a>
- **is_selected** (_boolean_)

View File

@@ -2,6 +2,8 @@
> at /druid/extended/lang_text.lua
The component used for displaying localized text, can automatically update text when locale is changed
## Functions
- [init](#init)
@@ -55,7 +57,7 @@ Setup raw text to lang_text component
- `text` *(string)*: Text for text node
- **Returns:**
- `Current` *(druid.lang_text)*: instance
- `self` *(druid.lang_text)*: Current instance
### set_text
@@ -70,7 +72,7 @@ Setup raw text to lang_text component
- `text` *(string)*: Text for text node
- **Returns:**
- `Current` *(druid.lang_text)*: instance
- `self` *(druid.lang_text)*: Current instance
### translate
@@ -86,7 +88,7 @@ Translate the text by locale_id
- `...` *(...)*: vararg
- **Returns:**
- `Current` *(druid.lang_text)*: instance
- `self` *(druid.lang_text)*: Current instance
### format
@@ -101,19 +103,19 @@ Format string with new text params on localized text
- `...` *(...)*: vararg
- **Returns:**
- `Current` *(druid.lang_text)*: instance
- `self` *(druid.lang_text)*: Current instance
## Fields
<a name="text"></a>
- **text** (_druid.text_)
- **text** (_druid.text_): The text component
<a name="node"></a>
- **node** (_node_)
- **node** (_node_): The node of the text component
<a name="on_change"></a>
- **on_change** (_event_)
- **on_change** (_event_): The event triggered when the text is changed
<a name="druid"></a>
- **druid** (_druid.instance_)
- **druid** (_druid.instance_): The Druid Factory used to create components

View File

@@ -2,6 +2,8 @@
> at /druid/extended/layout.lua
The component used for managing the layout of nodes, placing them inside the node size with respect to the size and pivot of each node
## Functions
- [init](#init)
@@ -57,7 +59,7 @@ layout_type:
- **Parameters:**
- `node_or_node_id` *(string|node)*:
- `layout_type` *(druid.layout.mode)*:
- `layout_type` *("horizontal"|"horizontal_wrap"|"vertical")*:
### update
@@ -74,18 +76,21 @@ layout:get_entities()
```
- **Returns:**
- `` *(node[])*:
- `entities` *(node[])*: The entities to manage the layout of
### set_node_index
---
```lua
layout:set_node_index([node], [index])
layout:set_node_index(node, index)
```
- **Parameters:**
- `[node]` *(any)*:
- `[index]` *(any)*:
- `node` *(node)*: The node to set the index of
- `index` *(number)*: The index to set the node to
- **Returns:**
- `self` *(druid.layout)*: for chaining
### set_margin
@@ -94,12 +99,14 @@ layout:set_node_index([node], [index])
layout:set_margin([margin_x], [margin_y])
```
Set the margin of the layout
- **Parameters:**
- `[margin_x]` *(number|nil)*:
- `[margin_y]` *(number|nil)*:
- `[margin_x]` *(number|nil)*: The margin x
- `[margin_y]` *(number|nil)*: The margin y
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### set_padding
@@ -109,13 +116,13 @@ layout:set_padding([padding_x], [padding_y], [padding_z], [padding_w])
```
- **Parameters:**
- `[padding_x]` *(number|nil)*:
- `[padding_y]` *(number|nil)*:
- `[padding_z]` *(number|nil)*:
- `[padding_w]` *(number|nil)*:
- `[padding_x]` *(number|nil)*: The padding x
- `[padding_y]` *(number|nil)*: The padding y
- `[padding_z]` *(number|nil)*: The padding z
- `[padding_w]` *(number|nil)*: The padding w
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### set_dirty
@@ -125,7 +132,7 @@ layout:set_dirty()
```
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### set_justify
@@ -138,7 +145,7 @@ layout:set_justify(is_justify)
- `is_justify` *(boolean)*:
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### set_type
@@ -151,7 +158,7 @@ layout:set_type(type)
- `type` *(string)*: The layout type: "horizontal", "vertical", "horizontal_wrap"
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### set_hug_content
@@ -165,7 +172,7 @@ layout:set_hug_content(is_hug_width, is_hug_height)
- `is_hug_height` *(boolean)*:
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### add
@@ -180,7 +187,7 @@ Add node to layout
- `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### remove
@@ -226,7 +233,7 @@ layout:refresh_layout()
```
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### clear_layout
@@ -236,7 +243,7 @@ layout:clear_layout()
```
- **Returns:**
- `` *(druid.layout)*:
- `self` *(druid.layout)*: Current layout instance
### get_node_size
@@ -249,8 +256,8 @@ layout:get_node_size(node)
- `node` *(node)*:
- **Returns:**
- `` *(number)*:
- `` *(number)*:
- `width` *(number)*: The width of the node
- `height` *(number)*: The height of the node
### calculate_rows_data
@@ -282,7 +289,7 @@ layout:set_node_position(node, x, y)
## Fields
<a name="node"></a>
- **node** (_node_)
- **node** (_node_): The node to manage the layout of
<a name="rows_data"></a>
- **rows_data** (_druid.layout.rows_data_): Last calculated rows data
@@ -291,28 +298,28 @@ layout:set_node_position(node, x, y)
- **is_dirty** (_boolean_)
<a name="entities"></a>
- **entities** (_node[]_)
- **entities** (_node[]_): The entities to manage the layout of
<a name="margin"></a>
- **margin** (_{ x: number, y: number }_)
- **margin** (_{ x: number, y: number }_): The margin of the layout
<a name="padding"></a>
- **padding** (_vector4_)
- **padding** (_vector4_): The padding of the layout
<a name="type"></a>
- **type** (_string_)
- **type** (_string_): The type of the layout
<a name="is_resize_width"></a>
- **is_resize_width** (_boolean_)
- **is_resize_width** (_boolean_): True if the layout should resize the width of the node
<a name="is_resize_height"></a>
- **is_resize_height** (_boolean_)
- **is_resize_height** (_boolean_): True if the layout should resize the height of the node
<a name="is_justify"></a>
- **is_justify** (_boolean_)
- **is_justify** (_boolean_): True if the layout should justify the nodes
<a name="on_size_changed"></a>
- **on_size_changed** (_event.on_size_changed_)
- **on_size_changed** (_event.on_size_changed_): The event triggered when the size of the layout is changed
<a name="size"></a>
- **size** (_unknown_)

View File

@@ -2,6 +2,8 @@
> at /druid/extended/progress.lua
The component used to manage a node as a progress bar, changing the size and scale of the node
## Functions
- [init](#init)
@@ -46,7 +48,7 @@ progress:init(node, key, [init_value])
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself.
- `key` *(string)*: Progress bar direction: const.SIDE.X or const.SIDE.Y
- `key` *(string)*: Progress bar direction: "x" or "y"
- `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
### on_style_change
@@ -90,7 +92,10 @@ progress:update(dt)
progress:fill()
```
Fill a progress bar and stop progress animation
Fill the progress bar
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### empty
@@ -99,7 +104,10 @@ Fill a progress bar and stop progress animation
progress:empty()
```
Empty a progress bar
Empty the progress bar
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### set_to
@@ -113,6 +121,9 @@ Instant fill progress bar to value
- **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### get
---
@@ -120,10 +131,10 @@ Instant fill progress bar to value
progress:get()
```
Return current progress bar value
Return the current value of the progress bar
- **Returns:**
- `` *(number)*:
- `value` *(number)*: The current value of the progress bar
### set_steps
@@ -138,6 +149,9 @@ Set points on progress bar to fire the callback
- `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### to
---
@@ -151,6 +165,9 @@ Start animation of a progress bar
- `to` *(number)*: value between 0..1
- `[callback]` *(function|nil)*: Callback on animation ends
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### set_max_size
---
@@ -164,7 +181,7 @@ Set progress bar max node size
- `max_size` *(vector3)*: The new node maximum (full) size
- **Returns:**
- `Progress` *(druid.progress)*:
- `self` *(druid.progress)*: Current progress instance
## Fields

View File

@@ -1,39 +1,27 @@
# druid.progress API
# druid.slider API
> at /druid/extended/progress.lua
> at /druid/extended/slider.lua
The component to make a draggable node over a line with a progress report
## Functions
- [init](#init)
- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change)
- [on_remove](#on_remove)
- [update](#update)
- [fill](#fill)
- [empty](#empty)
- [set_to](#set_to)
- [get](#get)
- [on_window_resized](#on_window_resized)
- [on_input](#on_input)
- [set](#set)
- [set_steps](#set_steps)
- [to](#to)
- [set_max_size](#set_max_size)
- [set_input_node](#set_input_node)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
## Fields
- [node](#node)
- [on_change](#on_change)
- [on_change_value](#on_change_value)
- [style](#style)
- [key](#key)
- [prop](#prop)
- [scale](#scale)
- [size](#size)
- [max_size](#max_size)
- [slice](#slice)
- [last_value](#last_value)
- [slice_size](#slice_size)
- [target](#target)
- [steps](#steps)
- [step_callback](#step_callback)
- [target_callback](#target_callback)
@@ -41,175 +29,136 @@
---
```lua
progress:init(node, key, [init_value])
slider:init(node, end_pos, [callback])
```
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself.
- `key` *(string)*: Progress bar direction: const.SIDE.X or const.SIDE.Y
- `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
### on_style_change
---
```lua
progress:on_style_change(style)
```
The Slider constructor
- **Parameters:**
- `style` *(druid.progress.style)*:
- `node` *(node)*: GUI node to drag as a slider
- `end_pos` *(vector3)*: The end position of slider, should be on the same axis as the node
- `[callback]` *(function|nil)*: On slider change callback
### on_layout_change
---
```lua
progress:on_layout_change()
slider:on_layout_change()
```
### on_remove
---
```lua
progress:on_remove()
slider:on_remove()
```
### update
### on_window_resized
---
```lua
progress:update(dt)
slider:on_window_resized()
```
### on_input
---
```lua
slider:on_input(action_id, action)
```
- **Parameters:**
- `dt` *(number)*: Delta time
### fill
---
```lua
progress:fill()
```
Fill a progress bar and stop progress animation
### empty
---
```lua
progress:empty()
```
Empty a progress bar
### set_to
---
```lua
progress:set_to(to)
```
Instant fill progress bar to value
- **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1
### get
---
```lua
progress:get()
```
Return current progress bar value
- `action_id` *(number)*: The action id
- `action` *(action)*: The action table
- **Returns:**
- `` *(number)*:
- `is_consumed` *(boolean)*: True if the input was consumed
### set
---
```lua
slider:set(value, [is_silent])
```
Set value for slider
- **Parameters:**
- `value` *(number)*: Value from 0 to 1
- `[is_silent]` *(boolean|nil)*: Don't trigger event if true
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### set_steps
---
```lua
progress:set_steps(steps, callback)
slider:set_steps(steps)
```
Set points on progress bar to fire the callback
Set slider steps. Pin node will
apply closest step position
- **Parameters:**
- `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value
### to
---
```lua
progress:to(to, [callback])
```
Start animation of a progress bar
- **Parameters:**
- `to` *(number)*: value between 0..1
- `[callback]` *(function|nil)*: Callback on animation ends
### set_max_size
---
```lua
progress:set_max_size(max_size)
```
Set progress bar max node size
- **Parameters:**
- `max_size` *(vector3)*: The new node maximum (full) size
- `steps` *(number[])*: Array of steps
- **Returns:**
- `Progress` *(druid.progress)*:
- `self` *(druid.slider)*: Current slider instance
### set_input_node
---
```lua
slider:set_input_node([input_node])
```
Set input zone for slider.
User can touch any place of node, pin instantly will
move at this position and node drag will start.
This function require the Defold version 1.3.0+
- **Parameters:**
- `[input_node]` *(string|node|nil)*:
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### set_enabled
---
```lua
slider:set_enabled(is_enabled)
```
Set Slider input enabled or disabled
- **Parameters:**
- `is_enabled` *(boolean)*: True if slider is enabled
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### is_enabled
---
```lua
slider:is_enabled()
```
Check if Slider component is enabled
- **Returns:**
- `is_enabled` *(boolean)*: True if slider is enabled
## Fields
<a name="node"></a>
- **node** (_node_)
- **node** (_node_): The node to manage the slider
<a name="on_change"></a>
- **on_change** (_event_)
<a name="on_change_value"></a>
- **on_change_value** (_event_): The event triggered when the slider value changes
<a name="style"></a>
- **style** (_druid.progress.style_)
<a name="key"></a>
- **key** (_string_)
<a name="prop"></a>
- **prop** (_hash_)
<a name="scale"></a>
- **scale** (_unknown_)
<a name="size"></a>
- **size** (_unknown_)
<a name="max_size"></a>
- **max_size** (_unknown_)
<a name="slice"></a>
- **slice** (_unknown_)
<a name="last_value"></a>
- **last_value** (_number_)
<a name="slice_size"></a>
- **slice_size** (_unknown_)
<a name="target"></a>
- **target** (_nil_)
<a name="steps"></a>
- **steps** (_number[]_)
<a name="step_callback"></a>
- **step_callback** (_function_)
<a name="target_callback"></a>
- **target_callback** (_function|nil_)
- **style** (_table_): The style of the slider

View File

@@ -2,13 +2,11 @@
> at /druid/extended/swipe.lua
The component to manage swipe events over a node
## Functions
- [init](#init)
- [on_late_init](#on_late_init)
- [on_style_change](#on_style_change)
- [on_input](#on_input)
- [on_input_interrupt](#on_input_interrupt)
- [set_click_zone](#set_click_zone)
@@ -31,44 +29,6 @@ swipe:init(node_or_node_id, on_swipe_callback)
- `node_or_node_id` *(string|node)*:
- `on_swipe_callback` *(function)*:
### on_late_init
---
```lua
swipe:on_late_init()
```
### on_style_change
---
```lua
swipe:on_style_change(style)
```
- **Parameters:**
- `style` *(druid.swipe.style)*:
### on_input
---
```lua
swipe:on_input(action_id, action)
```
- **Parameters:**
- `action_id` *(hash)*:
- `action` *(action)*:
- **Returns:**
- `` *(boolean)*:
### on_input_interrupt
---
```lua
swipe:on_input_interrupt()
```
### set_click_zone
---
@@ -76,8 +36,7 @@ swipe:on_input_interrupt()
swipe:set_click_zone([zone])
```
Strict swipe click area. Useful for
restrict events outside stencil node
Set the click zone for the swipe, useful for restricting events outside stencil node
- **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node
@@ -85,14 +44,14 @@ restrict events outside stencil node
## Fields
<a name="node"></a>
- **node** (_node_)
- **node** (_node_): The node to manage the swipe
<a name="on_swipe"></a>
- **on_swipe** (_event_): function(side, dist, dt), side - "left", "right", "up", "down"
- **on_swipe** (_event_): fun(context, side, dist, dt) The event triggered when a swipe is detected
<a name="style"></a>
- **style** (_table_)
- **style** (_druid.swipe.style_): The style of the swipe
<a name="click_zone"></a>
- **click_zone** (_node_)
- **click_zone** (_node_): The click zone of the swipe

View File

@@ -2,11 +2,11 @@
> at /druid/extended/timer.lua
The component that handles a text to display a seconds timer
## Functions
- [init](#init)
- [update](#update)
- [on_layout_change](#on_layout_change)
- [set_to](#set_to)
- [set_state](#set_state)
- [set_interval](#set_interval)
@@ -42,23 +42,6 @@ timer:init(node, [seconds_from], [seconds_to], [callback])
- **Returns:**
- `` *(druid.timer)*:
### update
---
```lua
timer:update([dt])
```
- **Parameters:**
- `[dt]` *(any)*:
### on_layout_change
---
```lua
timer:on_layout_change()
```
### set_to
---
@@ -66,11 +49,13 @@ timer:on_layout_change()
timer:set_to(set_to)
```
Set the timer to a specific value
- **Parameters:**
- `set_to` *(number)*: Value in seconds
- **Returns:**
- `self` *(druid.timer)*:
- `self` *(druid.timer)*: Current timer instance
### set_state
@@ -79,11 +64,13 @@ timer:set_to(set_to)
timer:set_state([is_on])
```
Set the timer to a specific value
- **Parameters:**
- `[is_on]` *(boolean|nil)*: Timer enable state
- **Returns:**
- `self` *(druid.timer)*:
- `self` *(druid.timer)*: Current timer instance
### set_interval
@@ -92,38 +79,40 @@ timer:set_state([is_on])
timer:set_interval(from, to)
```
Set the timer interval
- **Parameters:**
- `from` *(number)*: Start time in seconds
- `to` *(number)*: Target time in seconds
- **Returns:**
- `self` *(druid.timer)*:
- `self` *(druid.timer)*: Current timer instance
## Fields
<a name="on_tick"></a>
- **on_tick** (_event_)
- **on_tick** (_event_): fun(context, value) The event triggered when the timer ticks
<a name="on_set_enabled"></a>
- **on_set_enabled** (_event_)
- **on_set_enabled** (_event_): fun(context, is_on) The event triggered when the timer is enabled
<a name="on_timer_end"></a>
- **on_timer_end** (_event_)
- **on_timer_end** (_event_): fun(context) The event triggered when the timer ends
<a name="node"></a>
- **node** (_node_)
- **node** (_node_): The node to display the timer
<a name="from"></a>
- **from** (_number_)
- **from** (_number_): The start time of the timer
<a name="target"></a>
- **target** (_number_)
- **target** (_number_): The target time of the timer
<a name="value"></a>
- **value** (_number_)
- **value** (_number_): The current value of the timer
<a name="is_on"></a>
- **is_on** (_boolean_)
- **is_on** (_boolean_): True if the timer is on
<a name="temp"></a>
- **temp** (_unknown_)