Class Slider

A class representing a slider where you can select a value from a specific range.

@ extends Widget implements ValueWidget

Hierarchy (view full)

Implements

Constructors

  • Create a new slider and initialize it.

    Parameters

    • options: {
          callback?: null;
          label?: string;
          max?: number;
          min?: number;
          step?: number;
          value?: number;
      }

      The options for the slider

      • Optional callback?: null

        The function to call when the slider is changed

      • Optional label?: string

        The label text

      • Optional max?: number

        The maximum value

      • Optional min?: number

        The minimum value

      • Optional step?: number

        The step size

      • Optional value?: number

        The initial value

    Returns Slider

Properties

accuracy: number
labelRef: HTMLDivElement
listeners: {
    [key: string]: Function[];
}

Type declaration

  • [key: string]: Function[]
max: number
min: number
ref: HTMLDivElement
sliderRef: HTMLDivElement
step: number
thumbRef: HTMLDivElement
value: any
view: View

Methods

  • Bind a slider to an object property.

    Parameters

    • obj: any

      The object to bind the property to.

    • prop: string

      The property to bind.

    Returns this

  • Add a change event listener to the slider.

    Parameters

    • f: Function

      The function to call when the slider is changed.

    Returns this

  • Set the label of the slider.

    Parameters

    • text: string

      The new label text.

    Returns this

  • Set the maximum value of the slider.

    Parameters

    • max: number

      The new maximum value.

    Returns this

  • Set the minimum value of the slider.

    Parameters

    • min: number

      The new minimum value.

    Returns this

  • Set the step size of the slider.

    Parameters

    • step: number

      The new step size.

    Returns this