Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Slider Element Interface

janesconference edited this page Dec 8, 2011 · 2 revisions

The Slider Element is a vertical or horizontal slider control with a single value that ranges from 0 to 1. A Slider can be controlled by the user clicking on it and dragging it up and down (or left and right, if it's an horizontal slider). Two images are used to display the Slider: one for the the movable slider fader part and one for the unmovable slot part. The Slider interface is defined in Slider.js.

Constructor

Slider.prototype.getready = function (args) // {Object}

Constructor arguments (args).

Other than the Graphic-Element-Interface constructor parameters, Slider has some unique parameters:

  • sliderImage {Object} : the image for the unmovable slider-slot part.
  • knobImage {Object}: the image for the movable slider-fader part.
  • type {String: ['horizontal'] | ['vertical']} : this parameter specifies if the slider is oriented horizontally or vertically. The default is 'vertical'.

Properties and slot

  • values.slidervalue {Int} : The slidervalue of a Slider reflects its internal state. It ranges from 0 to 1.
  • defaultSlot {String = 'slidervalue} : The default slot of a Slider is its only slot, called 'slidervalue'.

Methods

_getKnobPosition()

Slider.prototype._getKnobPosition = function ()

This method returns the Slider fader image (knobImage) topleft position, in pixels, corresponding to the current Slider state (slidervalue).