Table of Contents

Class FlexalonScroller

Namespace
Flexalon
Assembly
Flexalon.dll

Scrolls Flexalon content with wheel/trackpad input, touch or optional mouse dragging, paging, item navigation, or direct API calls.

[DisallowMultipleComponent]
[AddComponentMenu("Flexalon/Flexalon Scroller")]
[DefaultExecutionOrder(10000)]
public class FlexalonScroller : MonoBehaviour
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
FlexalonScroller

Remarks

Disabling the component discards pending scroll requests. Requests made while the component is disabled, including ScrollTo, wait until it is enabled and layout is ready.

Properties

AutoHideScrollbars

Whether each scrollbar is shown only while its axis is enabled and the content is larger than the viewport.

public bool AutoHideScrollbars { get; set; }

Property Value

bool

Content

The content transform moved by the scroller.

public Transform Content { get; set; }

Property Value

Transform

CurrentPage

Current zero-based page indices from the start side: left on X, top on Y, and front on Z.

public Vector3Int CurrentPage { get; }

Property Value

Vector3Int

Depth

Whether the content can scroll on the Z axis.

public bool Depth { get; set; }

Property Value

bool

DepthScrollbar

Optional UGUI scrollbar that controls the normalized Z scroll position.

public Scrollbar DepthScrollbar { get; set; }

Property Value

Scrollbar

Horizontal

Whether the content can scroll on the X axis.

public bool Horizontal { get; set; }

Property Value

bool

HorizontalScrollbar

Optional UGUI scrollbar that controls the normalized X scroll position.

public Scrollbar HorizontalScrollbar { get; set; }

Property Value

Scrollbar

ItemCount

The number of items, which are the content's direct layout children in order, including virtual items that have no GameObject.

public int ItemCount { get; }

Property Value

int

MouseDrag

Whether the left mouse button drags the content, using the touch settings.

public bool MouseDrag { get; set; }

Property Value

bool

NormalizedPosition

The scroll position on each axis, where zero aligns minimum bounds and one aligns maximum bounds.

public Vector3 NormalizedPosition { get; }

Property Value

Vector3

PageCount

Number of pages along X, Y, and Z, including the initial page.

public Vector3Int PageCount { get; }

Property Value

Vector3Int

PageSize

The distance moved by paging when Use Custom Page Size is enabled.

public Vector3 PageSize { get; set; }

Property Value

Vector3

Position

The content position in its parent's local coordinate space.

public Vector3 Position { get; }

Property Value

Vector3

ProgrammaticBoundary

How ScrollTo, paging, and item navigation constrain their destination at the viewport bounds. Programmatic movement never overscrolls, so Elastic behaves like Clamp.

public FlexalonScrollerBoundary ProgrammaticBoundary { get; set; }

Property Value

FlexalonScrollerBoundary

ScrollBoundary

How desktop wheel and trackpad input behaves at the viewport bounds.

public FlexalonScrollerBoundary ScrollBoundary { get; set; }

Property Value

FlexalonScrollerBoundary

ScrollElasticDamping

The damping ratio applied while wheel overscroll springs back.

public float ScrollElasticDamping { get; set; }

Property Value

float

ScrollElasticLimit

The maximum wheel overscroll as a fraction of the viewport size.

public float ScrollElasticLimit { get; set; }

Property Value

float

ScrollElasticResponse

The approximate time in seconds for wheel overscroll to spring back.

public float ScrollElasticResponse { get; set; }

Property Value

float

ScrollMaximumVelocity

The maximum wheel spring velocity in content units per second.

public float ScrollMaximumVelocity { get; set; }

Property Value

float

ScrollSensitivity

The number of content units moved per desktop wheel or trackpad scroll unit.

public float ScrollSensitivity { get; set; }

Property Value

float

ScrollStopVelocity

The wheel spring velocity below which movement stops, in content units per second.

public float ScrollStopVelocity { get; set; }

Property Value

float

SmoothDamping

The damping ratio applied to smooth programmatic scrolling.

public float SmoothDamping { get; set; }

Property Value

float

SmoothResponse

The approximate time in seconds for smooth programmatic scrolling to reach its target.

public float SmoothResponse { get; set; }

Property Value

float

SmoothStopVelocity

The smooth programmatic scroll velocity below which movement stops, in content units per second.

public float SmoothStopVelocity { get; set; }

Property Value

float

TouchBoundary

How touch input behaves at the viewport bounds.

public FlexalonScrollerBoundary TouchBoundary { get; set; }

Property Value

FlexalonScrollerBoundary

TouchElasticDamping

The damping ratio applied while touch overscroll springs back.

public float TouchElasticDamping { get; set; }

Property Value

float

TouchElasticLimit

The maximum touch overscroll as a fraction of the viewport size.

public float TouchElasticLimit { get; set; }

Property Value

float

TouchElasticResponse

The approximate time in seconds for touch overscroll to spring back.

public float TouchElasticResponse { get; set; }

Property Value

float

TouchInertia

Whether content continues moving after a touch is released.

public bool TouchInertia { get; set; }

Property Value

bool

TouchMaximumVelocity

The maximum touch drag, inertia, and spring velocity in content units per second.

public float TouchMaximumVelocity { get; set; }

Property Value

float

TouchPlane

The viewport-local plane used to convert touch positions into 3D content movement.

public Plane TouchPlane { get; set; }

Property Value

Plane

TouchStopVelocity

The touch velocity below which inertia or spring movement stops, in content units per second.

public float TouchStopVelocity { get; set; }

Property Value

float

TouchVelocityHalfLife

The time in seconds for touch inertia velocity to decrease by half.

public float TouchVelocityHalfLife { get; set; }

Property Value

float

UseCustomPageSize

Whether Page Size is used instead of the viewport size for paging.

public bool UseCustomPageSize { get; set; }

Property Value

bool

ValueChanged

Invoked with the normalized position whenever the content position changes.

public FlexalonScrollEvent ValueChanged { get; }

Property Value

FlexalonScrollEvent

Vertical

Whether the content can scroll on the Y axis.

public bool Vertical { get; set; }

Property Value

bool

VerticalScrollbar

Optional UGUI scrollbar that controls the normalized Y scroll position.

public Scrollbar VerticalScrollbar { get; set; }

Property Value

Scrollbar

Viewport

The GameObject whose Flexalon node defines the visible bounds.

public GameObject Viewport { get; set; }

Property Value

GameObject

Methods

NextItem(int, Vector3, bool)

Moves by a number of items from the item at the viewport's alignment point, then aligns the destination like ScrollToItem. During smooth movement, counts from the pending destination. Moving back from an item that is only partly scrolled past aligns that item first.

public bool NextItem(int offset, Vector3 alignment, bool smooth = true)

Parameters

offset int

Items to move: positive moves to later items, negative to earlier ones.

alignment Vector3

Per-axis alignment, as in ScrollToItem.

smooth bool

Whether to use the scroller's smooth programmatic movement.

Returns

bool

True if queued or applied. False if no calculated destination item is available.

NextPage(Direction, bool)

Moves one page farther in the given content direction.

public void NextPage(Direction direction, bool smooth = true)

Parameters

direction Direction
smooth bool

OnBeginDrag(PointerEventData)

public void OnBeginDrag(PointerEventData eventData)

Parameters

eventData PointerEventData

OnDrag(PointerEventData)

public void OnDrag(PointerEventData eventData)

Parameters

eventData PointerEventData

OnEndDrag(PointerEventData)

public void OnEndDrag(PointerEventData eventData)

Parameters

eventData PointerEventData

OnInitializePotentialDrag(PointerEventData)

public void OnInitializePotentialDrag(PointerEventData eventData)

Parameters

eventData PointerEventData

OnPointerExit(PointerEventData)

public void OnPointerExit(PointerEventData eventData)

Parameters

eventData PointerEventData

OnScroll(PointerEventData)

public void OnScroll(PointerEventData eventData)

Parameters

eventData PointerEventData

ScrollTo(Vector3, bool)

Moves the content to a position in its parent's local coordinate space. Requests wait until the component is enabled and layout is ready.

public void ScrollTo(Vector3 position, bool smooth = true)

Parameters

position Vector3
smooth bool

ScrollToItem(int, Vector3, bool)

Aligns an item's layout bounds with the viewport on enabled scroll axes, subject to ProgrammaticBoundary. Items are the content's direct layout children in order, including virtual items. Queues the request until viewport and content layout results are available.

public bool ScrollToItem(int index, Vector3 alignment, bool smooth = true)

Parameters

index int

The zero-based item index.

alignment Vector3

Per-axis alignment, clamped to zero through one: zero aligns minimum edges, one half aligns centers, and one aligns maximum edges.

smooth bool

Whether to use the scroller's smooth programmatic movement.

Returns

bool

True if queued or applied. False if the item is known to have no layout result.

ScrollToNormalized(Vector3, bool)

Moves to a normalized position, clamped to zero through one on each axis.

public void ScrollToNormalized(Vector3 normalizedPosition, bool smooth = true)

Parameters

normalizedPosition Vector3
smooth bool

ScrollToObject(GameObject, bool)

Centers the target's layout bounds in the viewport on enabled scroll axes.

public void ScrollToObject(GameObject target, bool smooth = true)

Parameters

target GameObject

The content GameObject or a descendant at any depth, with a calculated Flexalon result.

smooth bool

Whether to use the scroller's smooth programmatic movement.

ScrollToObject(GameObject, Vector3, bool)

Aligns the target's layout bounds with the viewport on enabled scroll axes, subject to ProgrammaticBoundary. The destination is calculated when the request executes and does not follow subsequent target layout changes. Requests wait for viewport and content layout. A deferred request is skipped if its target is unavailable at execution.

public void ScrollToObject(GameObject target, Vector3 alignment, bool smooth = true)

Parameters

target GameObject

The content GameObject or a descendant at any depth, with a calculated Flexalon result.

alignment Vector3

Per-axis alignment, clamped to zero through one: zero aligns minimum edges, one half aligns centers, and one aligns maximum edges.

smooth bool

Whether to use the scroller's smooth programmatic movement.

SetPage(Direction, int, bool)

Moves to a zero-based page on the axis selected by direction. Positive and negative directions select the same page index; pages count from left on X, top on Y, and front on Z.

public void SetPage(Direction direction, int value, bool smooth = true)

Parameters

direction Direction
value int
smooth bool