Knob
The Knob
component is the Komplete UI representation of a KSP ui_knob
.
import { Knob } from kontakt_controls
export var main = Knob(
control_id: "my_knob",
label: "My Knob",
)
Behaviours
- Holding
Shift
while dragging enters a "finetuning mode" that can be configured via fine_step_count - Tapping 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: KnobStyle = default_knob_style
Controls the visual appearance of the knob.
See KnobStyle 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 = 0.5
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
.
KnobStyle
export type KnobStyle = DraggableControlStyle
export var default_knob_style = KnobStyle(
width: nil,
height: nil,
image: default_knob_image,
handle_size: 0,
padding: EdgeInsets(0),
label_style: LabelStyle(),
axis: Axis.vertical,
disabled_opacity: 0.24,
)