Lens Scripting API

    This class is responsible for creating and positioning grid content items based on a specified prefab and item count. It instantiates the items and arranges them vertically with a specified offset.

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    _debugDrawEnabled: boolean = false

    Shows visual debugging elements for scroll area bounds and content.

    _enableScrollInertia: boolean = true

    Enables physics-based scrolling where content continues moving after release with gradual deceleration and elastic bounce-back at boundaries."

    _scrollLimit: number = 0.3

    Controls how much content must remain visible. 0: Content can scroll completely out of view. 0.5: At least 50% of the content will remain in the visible area. 1: Content can't scroll out of view at all.

    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.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    enableHorizontalScroll: boolean = false

    Allows content to be scrolled horizontally.

    enableScrollLimit: boolean = true

    When enabled, prevents content from scrolling beyond designated boundaries defined by the Scroll Limit.

    enableVerticalScroll: boolean = true

    Allows content to be scrolled vertically.

    name: string
    onContentLengthChanged: PublicApi<void> = ...
    sceneObject: SceneObject

    The scene object this component is on.

    scrollAreaBounds: vec2 = ...

    Defines the size of the interactive area in normalized local coordinates, where (1,1) uses the full component size.

    uniqueIdentifier: string
    updatePriority: number

    Accessors

    • get contentLength(): number

      Returns number

      the length of the content along the y-axis in local units relative to the ScrollView canvas.

    • set contentLength(length: number): void

      Parameters

      • length: number

        the length of the content along the y-axis in local units relative to the ScrollView canvas.

      Returns void

    • get contentOffset(): Rect

      Returns Rect

      the offset to each content edge and the ScrollArea in world units relative to the canvas' rotation.

    • get contentPosition(): vec3

      Returns vec3

    • set contentPosition(position: vec3): void

      Parameters

      Returns void

    • get debugDrawEnabled(): boolean

      Returns boolean

    • set debugDrawEnabled(debugDrawEnabled: boolean): void

      Parameters

      • debugDrawEnabled: boolean

      Returns void

    • get enableScrollInertia(): boolean

      Returns boolean

    • set enableScrollInertia(enableScrollInertia: boolean): void

      Parameters

      • enableScrollInertia: boolean

      Returns void

    • get isDragging(): boolean

      Returns boolean

    • get isReady(): boolean

      Returns boolean

      if this class is ready to be used.

    • get overflow(): number

      Returns number

      the amount of content overflow along the y-axis in local units relative to the ScrollView's canvas.

    • get scrollAreaSize(): vec2

      Returns vec2

      the ScrollArea's size in local units relative to the ScrollView canvas.

    • get scrollColliderBounds(): vec2

      Returns vec2

      the ScrollArea collider's BoxShape's bounds.

    • set scrollColliderBounds(bounds: vec2): void

      Parameters

      • bounds: vec2

        the ScrollArea collider's BoxShape's bounds.

      Returns void

    • get scrollLimit(): number

      Returns number

    • set scrollLimit(limit: number): void

      Parameters

      • limit: number

      Returns void

    • get scrollPercentage(): number

      Returns number

      the scroll percentage of the ScrollView (0=top of ScrollView, 1= bottom).

    Methods

    • Checks if both inputted content edges are fully visible in the ScrollArea.

      Parameters

      • xEdge: -1 | 0 | 1

        0 if not checking any x-axis edge, 1 for right edge, -1 for left edge.

      • yEdge: -1 | 0 | 1

        0 if not checking any y-axis edge, 1 for top edge, -1 for bottom edge.

      Returns boolean

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

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Returns void

    • Resets the content origin for the purpose of calculating scrollPercentage. Assumes that the ScrollView is currently at the top of content in the pooling use case.

      Returns void

    • Resets the inertia velocity in the case that the developer wants to stop physics upon certain events.

      Returns void

    • Parameters

      Returns void

    MMNEPVFCICPMFPCPTTAAATR