content: VisualScroller
A scrollable container that allows smooth scrolling and dragging of content.
Supports touch/mouse dragging, momentum scrolling, bounce effects, and optional paging. Can scroll vertically or horizontally.
Static Members
threshold: FloatInstance Members
observedDirty: BoolDefault is false, automatically set to true when any of this instance's observable variables has changed.
The content visual that will be scrolled.
scrollbar: VisualOptional scrollbar visual that indicates scroll position. The scrollbar will be automatically positioned and sized.
Scroll direction: VERTICAL or HORIZONTAL.
allowPointerOutside: BoolWhether to allow pointer events outside the scroller bounds. When false, pointer events outside will be blocked.
scrollTransform: TransformTransform used to position the content for scrolling.
scrollEnabled: BoolWhether scrolling is enabled.
dragEnabled: BoolWhether dragging to scroll is enabled.
dragThreshold: FloatIf set to a value above zero, dragging should reach that
value before the scroller start to actually move its content.
In case the same value (or noDragThreshold value if above zero) is reached in wrong direction (vertical vs horizontal),
scroll will be entirely cancelled for the current touch.
This can be useful if you want to perform custom behaviour depending
on the direction of the drag, or if you want to nest two scrollers
that have different directions.
noDragThreshold: FloatIf set to a value above zero, when reaching that value in wrong direction (vertical vs horizontal), scroll will be entirely cancelled for the current touch.
roundScrollWhenIdle: IntIf set to a value above zero, scrollX and scrollY will be rounded when scroller is idle.
roundScrollWhenIdle = 0; // No rounding (default)
roundScrollWhenIdle = 1; // Pixel perfect rounding
roundScrollWhenIdle = 2; // Half-pixel rounding
Current status of the scroller. Can be IDLE, TOUCHING, DRAGGING, or SCROLLING.
verticalToHorizontalWheel: BoolWhen set to true, vertical mouse wheel events will also work on horizontal scrollers.
deceleration: FloatDeceleration rate for momentum scrolling (pixels per second squared).
wheelDeceleration: FloatDeceleration rate for mouse wheel scrolling (pixels per second squared).
wheelFactor: FloatMultiplier for mouse wheel scroll speed.
wheelMomentum: BoolWhether to apply momentum to mouse wheel scrolling.
wheelEndDelay: FloatDelay in seconds before wheel scrolling is considered ended.
overScrollResistance: FloatResistance factor when scrolling beyond bounds. Higher values make it harder to scroll past edges.
maxClickMomentum: FloatMaximum momentum that still allows a click to register. Higher momentum will cancel the click.
bounceMomentumFactor: FloatFactor for converting momentum to bounce distance.
bounceMinDuration: FloatMinimum duration for bounce animation in seconds.
bounceDurationFactor: FloatFactor for calculating bounce duration based on momentum.
bounceNoMomentumDuration: FloatDuration for bounce animation when there's no momentum.
dragFactor: FloatMultiplier for drag speed. Values less than 1.0 make dragging slower.
touchableStrictHierarchy: BoolWhether to use strict hierarchy checking for touch events.
scrollX: FloatCurrent horizontal scroll position.
scrollY: FloatCurrent vertical scroll position.
scrollVelocity: VelocityCurrent scroll velocity tracker. Used to calculate momentum when dragging ends.
momentum: FloatCurrent momentum value. Positive values scroll down/right, negative up/left.
animating: BoolWhether the scroller is currently animating.
pagingEnabled: BoolEnable paging of the scroller so that everytime we stop dragging, it snaps to the closest page.
pageSize: FloatWhen pagingEnabled is true, this is the size of a page.
If kept to -1 (default), it will use the scroller size.
pageSpacing: FloatWhen pagingEnabled is true, this is the spacing
between each page.
pageMomentumThreshold: FloatWhen pagingEnabled is true, this threshold value
will be used to move to a sibling page if the momentum
is equal or above it.
If kept to -1 (default), it will use the page size.
invalidateStatus(): Voiddestroy(): VoidscrollToBounds(): VoidScroll to ensure content is within bounds. If content is smaller than the scroller, it will be positioned at 0. If scrolled beyond bounds, it will snap back to the nearest edge.
Check if a content position is visible within the scroller bounds.
| Name | Type | Description |
|---|---|---|
x |
Float | X position in content coordinates |
y |
Float | Y position in content coordinates |
| Returns | Description |
|---|---|
| Bool | True if the position is visible |
Scroll to ensure a specific content position is visible.
| Name | Type | Description |
|---|---|---|
x |
Float | X position in content coordinates to make visible |
y |
Float | Y position in content coordinates to make visible |
isOverScrollingTop(): BoolCheck if content is scrolled beyond the top edge.
| Returns | Description |
|---|---|
| Bool | True if over-scrolled at top |
isOverScrollingBottom(): BoolCheck if content is scrolled beyond the bottom edge.
| Returns | Description |
|---|---|
| Bool | True if over-scrolled at bottom |
isOverScrollingLeft(): BoolCheck if content is scrolled beyond the left edge.
| Returns | Description |
|---|---|
| Bool | True if over-scrolled at left |
isOverScrollingRight(): BoolCheck if content is scrolled beyond the right edge.
| Returns | Description |
|---|---|
| Bool | True if over-scrolled at right |
stop(): VoidStop all scrolling and animations immediately.
stopTweens(): VoidStop any active scroll animations.
Immediately scroll to a specific position.
| Name | Type | Description |
|---|---|---|
scrollX |
Float | Target horizontal scroll position |
scrollY |
Float | Target vertical scroll position |
Smoothly animate scroll to a specific position.
| Name | Type | Default | Description |
|---|---|---|---|
scrollX |
Float | Target horizontal scroll position | |
scrollY |
Float | Target vertical scroll position | |
duration |
Float | 0.15 |
Animation duration in seconds (default: 0.15) |
easing |
Anonymous | (optional) | Easing function to use (default: QUAD_EASE_IN_OUT) |
| Name | Type | Default |
|---|---|---|
scrollX |
Float | |
scrollY |
Float | |
duration |
Float | 0.15 |
easing |
Anonymous | (optional) |
bounceScroll(): Void| Name | Type |
|---|---|
scrollX |
Float |
scrollY |
Float |
| Returns |
|---|
| Int |
computeTargetPageIndex(): Int| Returns |
|---|
| Int |
| Name | Type |
|---|---|
pageIndex |
Int |
smoothScrollToPageIndex(pageIndex: Int, ?duration: Float = 0.15, ?easing: Anonymous, ?allowOverscroll: Bool = false): Void| Name | Type | Default |
|---|---|---|
pageIndex |
Int | |
duration |
Float | 0.15 |
easing |
Anonymous | (optional) |
allowOverscroll |
Bool | false |
| Name | Type | Default |
|---|---|---|
pageIndex |
Int | |
allowOverscroll |
Bool | false |
| Returns |
|---|
| Float |
| Name | Type | Default |
|---|---|---|
pageIndex |
Int | |
allowOverscroll |
Bool | false |
| Returns |
|---|
| Float |
Create a new Scroller.
| Name | Type | Default | Description |
|---|---|---|---|
content |
Visual | (optional) | Optional content visual to scroll. If null, a new Visual is created. |
Private Members
prevPointerX: FloatprevPointerY: FloatdragThresholdStatus: ScrollerDragThresholdStatusposition: FloatcontentStart: FloatpointerStart: FloatpointerStartX: FloatpointerStartY: FloattouchIndex: IntreleaseSnap: BoolfromWheel: BoollastWheelEventTime: FloatcanClick: BooltweenX: TweentweenY: TweenpointerOnScroller: BoolpointerOnScrollerChild: BoolblockingDefaultScroll: BoolscrollbarDownX: FloatscrollbarDownY: FloatscrollbarStartX: FloatscrollbarStartY: FloatpageIndexOnStartDrag: IntEvent when any observable value as changed on this instance.
| Name | Type |
|---|---|
instance |
Scroller |
fromSerializedField |
Bool |
emitAnimateStart(): VoidEvent fired when scroll animation starts.
emitAnimateEnd(): VoidEvent fired when scroll animation ends.
emitDragStart(): VoidEvent fired when the user starts dragging.
emitDragEnd(): VoidEvent fired when the user stops dragging.
emitWheelStart(): VoidEvent fired when mouse wheel scrolling starts.
emitWheelEnd(): VoidEvent fired when mouse wheel scrolling ends.
Event fired when the scroller is clicked (tap without scrolling).
| Name | Type | Description |
|---|---|---|
info |
TouchInfo | Touch information for the click |
Event fired when pointer is pressed down on the scroller.
| Name | Type | Description |
|---|---|---|
info |
TouchInfo | Touch information |
Event fired when pointer is released from the scroller.
| Name | Type | Description |
|---|---|---|
info |
TouchInfo | Touch information |
emitStatusChange(current: Anonymous, previous: Anonymous): VoidEvent when status field changes.
| Name | Type |
|---|---|
current |
Anonymous |
previous |
Anonymous |
interceptPointerDown(hittingVisual: Visual, x: Float, y: Float, touchIndex: Int, buttonId: Int): Bool| Name | Type |
|---|---|
hittingVisual |
Visual |
x |
Float |
y |
Float |
touchIndex |
Int |
buttonId |
Int |
| Returns |
|---|
| Bool |
| Name | Type |
|---|---|
hittingVisual |
Visual |
x |
Float |
y |
Float |
| Returns |
|---|
| Bool |
startTracking(): VoidstopTracking(): Void| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
focusedVisual |
Visual |
roundScrollIfNeeded(): Void| Name | Type |
|---|---|
delta |
Float |
updateScrollbar(): Void| Name | Type |
|---|---|
scrollbar |
Visual |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type | Default |
|---|---|---|
pointerX |
Float | |
pointerY |
Float | |
delta |
Float | |
minusDelta |
Float | 0 |
Metadata
| Name | Parameters |
|---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |