Module Slider
Druid slider component
Functions
init(self, node, end_pos, callback) | The Slider constructor |
is_enabled(self) | Check if Slider component is enabled |
set(self, value, is_silent) | Set value for slider |
set_enabled(self, is_enabled) | Set Slider input enabled or disabled |
set_input_node(self, input_node) | Set input zone for slider. |
set_steps(self, steps) | Set slider steps. |
Fields
dist | Length between start and end position |
end_pos | End pin node position |
is_drag | Current drag state |
node | Slider pin node |
on_change_value | On change value callback(self, value) |
pos | Current pin node position |
start_pos | Start pin node position |
target_pos | Targer pin node position |
value | Current slider value |
Functions
- init(self, node, end_pos, callback)
-
The Slider constructor
Parameters:
- is_enabled(self)
-
Check if Slider component is enabled
Parameters:
- self Slider Slider
Returns:
-
boolean
- set(self, value, is_silent)
-
Set value for slider
Parameters:
- self Slider Slider
- value number Value from 0 to 1
- is_silent boolean or nil Don't trigger event if true
- set_enabled(self, is_enabled)
-
Set Slider input enabled or disabled
Parameters:
- self Slider Slider
- is_enabled boolean
- set_input_node(self, 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:
Returns:
-
Slider
Slider
- set_steps(self, steps)
-
Set slider steps. Pin node will
apply closest step position
Parameters:
- self Slider Slider
- steps number[] Array of steps
Returns:
-
Slider
Slider
Usage:
slider:set_steps({0, 0.2, 0.6, 1})
Fields
- dist
-
Length between start and end position
- dist vector3
- end_pos
-
End pin node position
- end_pos vector3
- is_drag
-
Current drag state
- is_drag boolean
- node
-
Slider pin node
- node node
- on_change_value
-
On change value callback(self, value)
- on_change_value DruidEvent DruidEvent
- pos
-
Current pin node position
- pos vector3
- start_pos
-
Start pin node position
- start_pos vector3
- target_pos
-
Targer pin node position
- target_pos vector3
- value
-
Current slider value
- value number