Class: ScrollBar

ScrollBar

ScrollBar

new GOWN.ScrollBar(direction, theme)

Scroll bar with thumb hosting some Viewport (e.g. a ScrollContainer or a Texture)
Name Type Default Description
direction String Scrollable.HORIZONTAL optional Direction of the scroll bar (horizontal/vertical)
theme GOWN.Theme optional theme for the scrollbar

Extends

Members

static,readonlyGOWN.ScrollBar.SKIN_NAMEString

Default scroll bar skin name

allowDestroyCachebool

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

directionString

Determines if the scroll bar's thumb can be dragged horizontally or vertically.

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

minThumbHeightNumber

The minimum thumb height
Default Value:
  • 20

minThumbWidthNumber

The minimum thumb width
Default Value:
  • 20

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

The skin name
Default Value:
  • ScrollBar.SKIN_NAME

valueNumber

Value of the scrollbar

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
Scroll to a specific position (not implemented yet)
Change the theme
Name Type Description
theme GOWN.Theme the new theme

thumbMoved(x, y)

Thumb has been moved. Scroll content to position
Name Type Description
x x-position to scroll to (ignored when vertical)
y y-position to scroll 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