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

@@ -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