Class: ScrollViewComponent

pc.ScrollViewComponent

A ScrollViewComponent enables a group of entities to behave like a masked scrolling area, with optional horizontal and vertical scroll bars.

Constructor

new ScrollViewComponent(system, entity)

Create a new ScrollViewComponent.
Parameters:
Name Type Description
system pc.ScrollViewComponentSystem The ComponentSystem that created this Component
entity pc.Entity The Entity that this Component is attached to.
Properties:
Name Type Description
horizontal Boolean Whether to enable horizontal scrolling.
vertical Boolean Whether to enable vertical scrolling.
scrollMode pc.SCROLL_MODE Specifies how the scroll view should behave when the user scrolls past the end of the content. Modes are defined as follows:
bounceAmount Number Controls how far the content should move before bouncing back.
friction Number Controls how freely the content should move if thrown, i.e. by flicking on a phone or by flinging the scroll wheel on a mouse. A value of 1 means that content will stop immediately; 0 means that content will continue moving forever (or until the bounds of the content are reached, depending on the scrollMode).
horizontalScrollbarVisibility pc.SCROLLBAR_VISIBILITY Controls whether the horizontal scrollbar should be visible all the time, or only visible when the content exceeds the size of the viewport.
verticalScrollbarVisibility pc.SCROLLBAR_VISIBILITY Controls whether the vertical scrollbar should be visible all the time, or only visible when the content exceeds the size of the viewport.
viewportEntity pc.Entity The entity to be used as the masked viewport area, within which the content will scroll. This entity must have an ElementGroup component.
contentEntity pc.Entity The entity which contains the scrolling content itself. This entity must have an Element component.
horizontalScrollbarEntity pc.Entity The entity to be used as the vertical scrollbar. This entity must have a Scrollbar component.
verticalScrollbarEntity pc.Entity The entity to be used as the vertical scrollbar. This entity must have a Scrollbar component.
Source:

Extends

Events

set:scroll

Fired whenever the scroll position changes.
Parameters:
Name Type Description
scrollPosition pc.Vec2 Horizontal and vertical scroll values in the range 0...1.
Source: