SliderFieldView
A numeric input field with an integrated slider for intuitive value adjustment.
SliderFieldView combines a text input field with a horizontal slider, allowing users to either type values directly or drag the slider handle. The component supports numeric ranges, rounding precision, and can be disabled. The slider provides visual feedback and makes it easy to explore value ranges.
Key features:
- Text input with numeric validation
- Integrated horizontal slider with draggable handle
- Configurable min/max value ranges
- Precision rounding support
- Keyboard focus and tab navigation
- Optional text input disabling (slider-only mode)
- Visual feedback for hover, focus, and disabled states
Usage example:
var slider = new SliderFieldView(0, 100); // min: 0, max: 100
slider.value = 50;
slider.round = 1; // round to integers
slider.enabledTextInput = true;
slider.onValueChange(this, (value, prev) -> {
trace('Value changed to: ' + value);
});
add(slider);
Instance Members
Custom theme override for this slider field. If null, uses the global context theme
The current numeric value of the slider
Minimum allowed value for the slider
Maximum allowed value for the slider
Whether the text input portion is enabled for direct typing
Visual style of the field (DEFAULT, OVERLAY, or MINIMAL)
Whether the entire slider field is disabled and non-interactive
Precision for value rounding.
-1
: No rounding (default)1
: Round to integers10
: Round to tenths (0.1)100
: Round to hundredths (0.01)- etc.
Handles focus events for the slider field.
When the field gains focus, the text input is also focused for immediate editing.
Creates a new SliderFieldView with the specified value range.
Name | Type | Default | Description |
---|---|---|---|
minValue |
Float | 0 |
Minimum value for the slider (default: 0) |
maxValue |
Float | 1 |
Maximum value for the slider (default: 1) |
Private Members
Container view for the slider track and handle
The draggable handle/indicator of the slider
Event when theme field changes.
Name | Type |
---|---|
current |
Theme |
previous |
Theme |
Event when value field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when minValue field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when maxValue field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when enabledTextInput field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Event when inputStyle field changes.
Name | Type |
---|---|
current |
Anonymous |
previous |
Anonymous |
Event when disabled field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Clips the text display to fit within the available text area.
Name | Type | Description |
---|---|---|
width |
Float | Available width for text |
height |
Float | Available height for text |
Positions the slider handle based on the current value.
Calculates the handle position as a proportion of the value within the min/max range, accounting for container padding and handle width.
Applies rounding to a value based on the round precision setting.
Name | Type | Description |
---|---|---|
value |
Float | The value to round |
Returns | Description |
---|---|
Float | The rounded value |
Handles mouse/touch down events on the slider.
Starts slider interaction, sets initial value, and begins tracking pointer movement.
Name | Type | Description |
---|---|---|
info |
ceramic.TouchInfo | Touch/mouse interaction information |
Handles pointer movement during slider dragging.
Updates the slider value based on the current pointer position.
Name | Type | Description |
---|---|---|
info |
ceramic.TouchInfo | Touch/mouse interaction information |
Handles pointer release events, ending slider interaction.
Removes pointer tracking listeners when slider dragging ends.
Name | Type | Description |
---|---|---|
info |
ceramic.TouchInfo | Touch/mouse interaction information |
Converts a horizontal slider position to a value within the min/max range.
Calculates the proportional value based on slider position, applies range limits and rounding, then updates the field value.
Name | Type | Description |
---|---|---|
sliderX |
Float | Horizontal position within the slider container |
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |