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 skinDisplayObject -
inherited destroy()
-
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 nameString name of the state callbackfunction callback that is executed if the skin is loaded -
inherited protectedhandleDown(mouseData)
-
Handle mouse down/touch start. Move scroll thumb.
Name Type Description mouseDatamouse data provided by PIXI -
inherited protectedhandleMove(mouseData)
-
Handle mouse move. Moves the thumb.
Name Type Description mouseDatamouse data provided by PIXI -
inherited protectedhandleUp()
-
Handle mouse up/touch end
-
inherited protectedhandleWheel(event)
-
Handle mouse wheel. Moves thumb on track.
Name Type Description eventmouse wheel event from browser -
inherited maxHeight(){Number}
-
Returns the max. height in pixel (normally this.height - thumb height)
Returns:
Type Description Number -
inherited maxWidth(){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 xNumber New x position of the thumb yNumber 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 positionNumber 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 valueNumber The value to which the thumb gets moved -
inherited preloadSkins()
-
Initiate all skins first
-
inherited scrollToPosition()
-
Scroll to a specific position (not implemented yet)
-
inherited setTheme(theme)
-
Change the theme
Name Type Description themeGOWN.Theme the new theme -
thumbMoved(x, y)
-
Thumb has been moved. Scroll content to position
Name Type Description xx-position to scroll to (ignored when vertical) yy-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 dataupdated skin data -
inherited valueToPixel(value){Number}
-
Calculate current pixel position of thumb based on given value
Name Type Description valueNumber The value of the thumb position Returns:
Type Description Number Position of the scroll thumb in pixel