Class CvsSlider

This class represents a horizontal slider with a draggable thumb to define a value within user defined limits.

Major and minor tick marks can be added to the bar and supports stick-to-ticks if wanted.

Hierarchy

Properties

_limit0: number
_limit1: number
_majorTicks: number
_minorTicks: number
_s2ticks: boolean
_t01: number
action: Function = ...

The event handler for this control. Although it is permitted to set this property directly it is recommended that the setAction(...) method is used to define the event handler actions.

Methods

  • Add a child to this control using its relative position [rx, ry]. If rx and ry are not provided then it uses the values set in the child.

    Returns

    this control

    Parameters

    • c: string | CvsBaseControl

      is the actual control or its name

    • Optional rx: number
    • Optional ry: number

    Returns any

  • Set or get the corner radii used for this control

    Returns

    an array with the 4 corner radii

    Parameters

    • c: number[]

      an array of 4 corner radii

    Returns number[] | CvsBaseControl

  • Calculates the absolute position on the canvas taking into account any ancestors

    Returns

    the actual position in the canvas

    Returns __Position

  • Use enable() and disable() to enable and disable it.

    Returns

    true if the control is enabled else false

    Returns boolean

  • Returns

    true if the value lies within the slider's limits else false

    Parameters

    • value: number

      scale value to test

    Returns boolean

  • Returns

    true if this control is visible

    Since

    0.9.3

    Returns boolean

  • Set the lower and upper limits for the slider

    Returns

    this slider object

    Parameters

    • l0: number

      lower limit

    • l1: number

      upper limit

    Returns CvsSlider

  • Returns

    the unique identier for this control

    Returns string

  • Adds this control to another control which becomes its parent

    Returns

    this control

    Parameters

    • p: string | CvsBaseControl

      is the parental control or its name

    • Optional rx: number

      x position relative to parent

    • Optional ry: number

      y position relative to parent

    Returns CvsBaseControl

  • This sets the event handler to be used when this control fires an event. The parameter can take three forms:

    1. Arrow function definition
    2. Anonymous function definition
    3. Named function declaration

    Returns

    this control

    Parameters

    • event_handler: Function

      the function to handle this controls event

    Returns CvsSlider

  • Shrink the control to fit contents.

    To shrink on one dimension only pass either 'w' (width) or 'h' (height) to indicate which dimmension to shrink

    Returns

    this control

    Parameters

    • Optional dim: string

      the dimension to shrink

    Returns CvsBaseControl

  • The track can be divided up into a number of domains separated with major ticks. The major domains and be further divided into subdomains separated with minor ticks. If the final parameter is true then values retqurned by the slider are consrained to the tick values.

    Returns

    this slider object

    Parameters

    • major: number

      the number of major domains on the track

    • minor: number

      the number of minor domains between major ticks

    • Optional stick2ticks: boolean

      slider value is constrainged to tick values

    Returns CvsBaseControl

  • Sets the size of the text to use in the tooltip

    Parameters

    • Optional tsize: number

      text size for this tooltip

    Returns CvsSlider

  • Create a tooltip for this control

    Returns

    this control

    Parameters

    • tiptext: string

      the text to appear in the tooltip

    • duration: number

      how long the tip remains visible (milliseconds)

    Returns CvsSlider

  • If the parameter value is withing the slider limits it will move the thumb to the appropriate position. If no parameter is passed or is outside the limits this methods returns the current slider value.

    Returns

    the current value or this slider object

    Parameters

    • Optional value: number

      the selected value to be set

    Returns number | CvsBaseControl

Generated using TypeDoc