Slider
The Slider
component is the Komplete UI representation of a KSP ui_slider
.
import { Slider } from kontakt_controls
export var main = Slider(
control_id: "my_slider",
label: "My Slider",
)
Behaviours
- holding
Shift
while dragging enters a "finetuning mode" that can be configured viafine_step_count
- clicking while pressing
Ctrl
(Windows) /Cmd
(macOS) resets the slider to its default value.
Constructor
control_id: String Required
This is the name that you assigned to the corresponding KSP ui_knob
control.
label: String Required
The text to display when the control is resting. Typically, a descriptive name for the control.
step_count: Int? = nil
The number of steps from the slider's min
to its max
value (both as set in KSP). Leaving it at its default of nil
means that the step count will default to a step size of 1.
Please note:
- If you specify a step count that is bigger than
max-min
it will be clipped to that number. - If you specify a step count that does not result in an integer step size, the step count will be adjusted to the nearest number that results in an integer step size.
fine_step_count: Int = 1
The number of sub-steps that each step (as defined by the step_count property) is divided into when pressing Shift
while dragging.
style: SliderStyle = default_slider_style
Controls the visual appearance of the slider.
See SliderStyle for more details.
label_value_source: LabelValueSource = LabelValueSource.ksp_control_value
This property controls the source of the value that is being displayed in the slider's label while dragging.
LabelValueSource.ksp_control_value
makes the slider grab the value directly from the connected KSP control. This value can then further be formatted using thevalue_to_string
property.LabelValueSource.ksp_label_property
makes the slider use the text displayed in the KSP label associated with the slider control.
value_to_string: ValueFormatter = default_value_formatter
Converts the value to a string to be displayed in the label when the user interacts with the control. This property is ignored when label_value_source is set to LabelValueSource.ksp_label_property
.
By default simply shows the raw integer value of the control.
sensitivity: Float = 1
How sensitive the control responds.
When set to 1 one can move over the entire value range by moving from the leading edge to the trailing edge in the drag axis.
disabled: Bool = false
Disables all user interaction when true
.
Disables all user interaction when true
.
SliderStyle
export type SliderStyle = DraggableControlStyle
export var default_slider_style = SliderStyle(
width: nil,
height: nil,
image: default_slider_image,
handle_size: 16
padding: EdgeInsets(0),
label_style: LabelStyle(),
axis: Axis.horizontal,
disabled_opacity: 0.24,
)
Additional Information
In KSP it is relatively common to use a ui_slider
to implement a control that is visually a knob. You can do this with the Slider
as well:
import { Slider } from kontakt_controls
export var main = Slider(
control_id: "my_slider",
label: "My Slider",
style: default_knob_style,
)