Preparing search index...

    A low-level scrolling interaction solution for Spectacles.

    Children of this Component's SceneObject will be masked into windowSize and scrollable by scrollDimensions

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    api: Record<string, any>

    Generic object accessible by other instances of ScriptComponent. Use this object to store references to properties and methods that need to be accessible from other ScriptComponents.

    This property is no longer needed, you can use a reference to the ScriptComponent, including 'script', directly

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    frustum: Frustum = ...

    Frustum that handles helper viewport logic. Use this to test if your content is visible within the scroll window.

    isEnabledInHierarchy: boolean

    Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

    name: string
    onInitialized: PublicApi<void> = ...

    Event that fires when the ScrollWindow has been initialized

    onScrollDimensionsUpdated: PublicApi<vec2> = ...

    Event that fires when scroll dimensions are updated. Use this event to execute logic when the scrollable area size changes.

    onScrollDrag: PublicApi<ScrollEventArg> = ...

    Event that fires during scroll drag interactions. Use this event to execute logic when the user drags to scroll.

    onScrollPositionUpdated: PublicApi<vec2> = ...

    Event that fires when scroll position is updated. Use this event to execute logic when the scroll position changes. The position is in local space.

    sceneObject: SceneObject

    The SceneObject this component is on.

    uniqueIdentifier: string
    updatePriority: number

    Accessors

    • get edgeFade(): boolean

      Whether edge fade is enabled

      Returns boolean

      true if edge fade is enabled, false otherwise

    • set edgeFade(value: boolean): void

      Whether edge fade is enabled

      Parameters

      • value: boolean

        true to enable edge fade, false to disable

      Returns void

    • get enableChildCollidersBoundary(): Rect

      The boundary within which child colliders will be enabled when an interactor hovers over the ScrollWindow. Uses normalized positions from -1 to 1 on both axes. For example, if we provide a Rect with Rect.create(-1, 1, -0.8, 1), hovering the bottom 10% of the ScrollWindow will not enable the child ColliderComponents.

      Returns Rect

      The current enable child colliders boundary

    • set enableChildCollidersBoundary(value: Rect): void

      The boundary within which child colliders will be enabled when an interactor hovers over the ScrollWindow.

      Parameters

      • value: Rect

        The boundary rect using normalized positions from -1 to 1

      Returns void

    • get hardStopAtEnds(): boolean

      Whether hard stop at ends is enabled When true, disables the bounce-back effect at the edges of the scroll area. When false (default), the scroll window will use a spring animation to bounce back when scrolled beyond bounds.

      Returns boolean

      true if hard stop at ends is enabled, false otherwise

    • set hardStopAtEnds(value: boolean): void

      Whether hard stop at ends is enabled

      Parameters

      • value: boolean

        true to enable hard stop at ends, false to disable

      Returns void

    • get horizontal(): boolean

      Whether horizontal scrolling is enabled

      Returns boolean

      true if horizontal scrolling is enabled, false otherwise

    • set horizontal(value: boolean): void

      Whether horizontal scrolling is enabled

      Parameters

      • value: boolean

        true to enable horizontal scrolling, false to disable

      Returns void

    • get interactable(): Interactable

      The Interactable component of this scroll window

      Returns Interactable

      Interactable component

    • get isControlledExternally(): boolean

      Whether this scroll window is controlled externally

      Returns boolean

      true if controlled externally, false otherwise

    • set isControlledExternally(value: boolean): void

      Whether this scroll window is controlled externally

      Parameters

      • value: boolean

        true to control externally, false to control internally

      Returns void

    • get isInitialized(): boolean

      get whether this scroll window is initialized

      Returns boolean

    • get scrollDimensions(): vec2

      The size of the total scrollable area

      Returns vec2

      vec2 of the current scroll dimensions

    • set scrollDimensions(size: vec2): void

      The size of the total scrollable area

      Parameters

      • size: vec2

        The scroll dimensions in local space

      Returns void

    • get scrollingPaused(): boolean

      Whether scrolling is currently paused

      Returns boolean

      true if scrolling is paused, false otherwise

    • set scrollingPaused(scrollingPaused: boolean): void

      Pause or resume scrolling

      Parameters

      • scrollingPaused: boolean

        true to pause scrolling, false to resume

      Returns void

    • get scrollPosition(): vec2

      The scroll position in local space

      Returns vec2

    • set scrollPosition(position: vec2): void

      The scroll position in local space

      Parameters

      Returns void

    • get scrollPositionNormalized(): vec2

      The scroll position in normalized space -1, 1 on the x (left to right) if scrollDimensions.x is not -1, otherwise the scroll position.x in pixels -1, 1 on the y (bottom to top) if scrollDimensions.y is not -1, otherwise the scroll position.y in pixels

      Returns vec2

    • set scrollPositionNormalized(normalizedPosition: vec2): void

      The scroll position in normalized space -1, 1 on the x (left to right) -1, 1 on the y (bottom to top)

      Parameters

      • normalizedPosition: vec2

      Returns void

    • get scrollSnapping(): boolean

      Whether this scroll window is using snap scrolling

      Returns boolean

      true if snap scrolling is enabled, false otherwise

    • set scrollSnapping(scrollSnapping: boolean): void

      Whether this scroll window is using snap scrolling

      Parameters

      • scrollSnapping: boolean

      Returns void

    • get snapRegion(): vec2

      The size of each snap segment in the scroll window

      Returns vec2

      vec2 of the size of each snap segment in local space.

    • set snapRegion(snapRegion: vec2): void

      The size of each snap segment in the scroll window

      Parameters

      • snapRegion: vec2

        The size of each snap segment in local space.

      Returns void

    • get vertical(): boolean

      Whether vertical scrolling is enabled

      Returns boolean

      true if vertical scrolling is enabled, false otherwise

    • set vertical(value: boolean): void

      Whether vertical scrolling is enabled

      Parameters

      • value: boolean

        true to enable vertical scrolling, false to disable

      Returns void

    • get windowSize(): vec2

      The size of the masked window viewport in local space

      Returns vec2

      vec2 of the current window size

    • set windowSize(size: vec2): void

      The size of the masked window viewport in local space

      Parameters

      • size: vec2

        The window size in local space

      Returns void

    Methods

    • Adds a SceneObject to this scroll window's scrollable content area. The object's parent will be set to the internal scroller object.

      Parameters

      • object: SceneObject

        The SceneObject to add to the scroll window

      Returns void

    • Gets the current scroll velocity (fling velocity).

      Returns vec3

      The current velocity as a vec3

    • Gets the viewable window of local space at zero depth. The window ranges from -windowSize.x/2 to windowSize.x/2 on the x-axis (left to right) and -windowSize.y/2 to windowSize.y/2 on the y-axis (bottom to top).

      Returns VisibleWindow

      VisibleWindow object containing bottomLeft and topRight corners in local space

    • Gets the viewable window in normalized space at zero depth. The window ranges from -1 to 1 on the x-axis (left to right) and -1 to 1 on the y-axis (bottom to top).

      Returns VisibleWindow

      VisibleWindow object containing bottomLeft and topRight corners in normalized space

    • Initializes the ScrollWindow component. This method runs once on creation and sets up all necessary components and event handlers.

      Returns void

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Sets the scroll velocity for programmatic scrolling animations.

      Parameters

      • velocity: vec2

        The velocity to set in local space units per frame

      Returns void

    • Helper function to tween scroll

      Parameters

      • position: vec2

        final position

      • time: number

        duration of tweened scroll in milliseconds

      Returns void