Class: Slider

Slider

Slider

new GOWN.Slider(theme)

Simple slider with min. and max. value
Name Type Description
theme GOWN.Theme optional theme for the slider

Extends

Members

static,readonlyGOWN.Slider.SKIN_NAMEString

Default slider skin name

allowDestroyCachebool

Will destroy the skin cache when the skinable gets destroyed
Default Value:
  • true

directionString

The scrollable direction
Default Value:
  • Scrollable.HORIZONTAL

enabledBoolean

Enables/Disables the control. (not implemented yet)

heightNumber

The height of the Scrollable, setting this will redraw the track and thumb.

inverseBoolean

Inverse the progress bar

maximumNumber

Set maximum and update value if necessary
Default Value:
  • 100

minimumNumber

Set minimum and update value if necessary
Default Value:
  • 0

modeString

The scrollable mode
Default Value:
  • Scrollable.DESKTOP_MODE

scrolldeltaNumber

Number of pixels you scroll at a time (if the event delta is 1 / -1)
Default Value:
  • 10

skinFallbackString

The fallback skin if the other skin does not exist (e.g. if a mobile theme that does not provide a "hover" state is used on a desktop system) (normally the default "up"-state skin)
Default Value:
  • 'up'

skinNameString

Change the skin name. You normally set the skin name as constant in your control, but if you want you can set another skin name to change skins for single components at runtime.

valueNumber

Set value (between minimum and maximum)
Default Value:
  • 0

widthNumber

The width of the Scrollable, setting this will redraw the track and thumb.

Methods

inherited changeSkin(skin)

Remove old skin and add new one
Name Type Description
skin DisplayObject
Destroy the Skinable and empty the skin cache

inherited fromSkin(name, callback)

Get image from skin (will execute a callback with the loaded skin when it is loaded or call it directly when it already is loaded)
Name Type Description
name String name of the state
callback function callback that is executed if the skin is loaded

inherited protectedhandleDown(mouseData)

Handle mouse down/touch start. Move scroll thumb.
Name Type Description
mouseData mouse data provided by PIXI

inherited protectedhandleMove(mouseData)

Handle mouse move. Moves the thumb.
Name Type Description
mouseData mouse data provided by PIXI
Handle mouse up/touch end

inherited protectedhandleWheel(event)

Handle mouse wheel. Moves thumb on track.
Name Type Description
event mouse wheel event from browser
Returns the max. height in pixel (normally this.height - thumb height)
Returns:
Type Description
Number
Returns the max. width in pixel (normally this.width - thumb width)
Returns:
Type Description
Number

inherited mousePos(){PIXI.Point}

Get the local mouse position from PIXI.InteractionData
Returns:
Type Description
PIXI.Point

inherited moveThumb(x, y){boolean}

Move the thumb on the scroll bar within its bounds
Name Type Description
x Number New x position of the thumb
y Number New y position of the thumb
Returns:
Type Description
boolean Returns true if the position of the thumb has been moved

inherited pixelToValue(position){Number}

Calculate value of slider based on the current pixel position of the thumb
Name Type Description
position Number current pixel position of the thumb
Returns:
Type Description
Number Value between minimum and maximum

inherited positionThumb(value)

Position the thumb to a given value
Name Type Description
value Number The value to which the thumb gets moved
Initiate all skins first
Update before draw call. Redraw track and progressbar and create thumb.
Scroll to a specific position (not implemented yet)
Change the theme
Name Type Description
theme GOWN.Theme the new theme
Thumb has new x/y position
Name Type Description
x Number x-position that has been scrolled to (ignored when vertical)
y Number y-position that has been scrolled to (ignored when horizontal)

inherited updateTheme(data)

Overwrite data from theme for this specific component. (usable if you want to change e.g. background color based on selected items)
Name Type Description
data updated skin data

inherited valueToPixel(value){Number}

Calculate current pixel position of thumb based on given value
Name Type Description
value Number The value of the thumb position
Returns:
Type Description
Number Position of the scroll thumb in pixel