Skip to main content

Stepper

Control the value of a KSP ui_value_edit

component Stepper

Example

import { Stepper } from kontakt_controls

export var main = Stepper(
control_id: "my_value_edit",
label: "My Value Edit",
default_value: 50,
)

Stepper Screenshot

Constructor

constructor(control_id: String, label: String, default_value: Int, text_previous: String? = nil, text_next: String? = nil, step_count: Int? = nil, fine_step_count: Int = 2, sensitivity: Float = 0.1, style: StepperStyle = StepperStyle(), value_to_string: ValueFormatter = default_value_formatter, disabled: Bool = false, on_editing_changed: (Bool) -> () = fun (editing: Bool) {}, policy: TriggerPolicy = TriggerPolicy.on_down)
control_id: String

The name of the KSP control.

label: String

The label to display when the control is resting.

default_value: Int

The default value to reset to with CTRL/CMD+Tap (temp, until we can fetch it from ui_value_edit).

text_previous: String? = nil

Text for the previous button, if any.

text_next: String? = nil

Text for the next, if any.

step_count: Int? = nil

Determines the number of steps it takes from min to max.

Uses the finest resolution when set to nil.

fine_step_count: Int = 2

Divides the steps further for fine tuning when "shift" is pressed. 1 means no fine-tuning.

sensitivity: Float = 0.1

How sensitive the control response is.

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.

style: StepperStyle = StepperStyle()

Customizes the appearance of the Stepper.

See StepperStyle.

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.

By default simply shows the raw integer value of the control.

disabled: Bool = false

Disables all user interaction when true.

on_editing_changed: (Bool) -> () = fun (editing: Bool) {}

Called when the user starts or ends interacting with the control.

policy: TriggerPolicy = TriggerPolicy.on_down

Stepping on pointer down or up with the up and down buttons. For more details, refer to TriggerPolicy.