Class Slider
A slider
Usage:
-- Create a slider
local slider = Slider(0, 0, 100, 12)
slider:addListener(
"value",
function(t, k, old, new)
world.logInfo("Slider is now at %s", new)
end)
Fields
-
Slider.handleBorderColor
-
The color of the slider handle border.
-
Slider.handleBorderSize
-
The thickness of the slider handle border.
-
Slider.handleColor
-
The color of the slider handle.
-
Slider.handleHoverColor
-
The color of the slider handle when the mouse is over it.
-
Slider.handlePressedColor
-
The color of the slider handle when it is being dragged.
-
Slider.handleSize
-
The size of the slider handle.
-
Slider.lineColor
-
The color of the slider line.
-
Slider.lineSize
-
The thickness of the slider line.
-
Slider.maxValue
-
The maximum value of the slider.
-
Slider.minValue
-
The minimum value of the slider.
-
Slider.value
-
The current value of the slider.
Constructor
-
Slider:_init (x, y, width, height[, min=0.0[, max=1.0[, step=nil[, vertical=false]]]])
-
Constructs a new Slider.
New sliders are by default horizontal.
Parameters:
- x
The x coordinate of the new component, relative to its parent.
- y
The y coordinate of the new component, relative to its parent.
- width
The width of the new component.
- height
The height of the new component.
- min
The maximum value of this slider. The slider will slide from
min to max.
(default 0.0)
- max
The maximum value of this slider. The slider will slide from
min to max.
(default 1.0)
- step
The step size to snap the slider to. If nil, the slider will
slide smoothly.
(default nil)
- vertical
If true, the slider will be vertical.
(default false)
Methods
-
Slider:getPercentage ()
-
Get the percentage of max that this slider's value is at.
Returns:
A percentage, from 0 to 1 inclusive.