ScrollState

class ScrollState(initialOffset: Double = 0.0)(source)

Caller-owned mutable position shared by a scroll area and zero or more independent scrollbars.

Reads, writes, runtime observation, and subscription release are confined to the construction execution owner. Area attachment publishes viewport and content geometry, while application calls may request positions before or after attachment. Requested positions are clamped whenever current geometry is known. The state owns no retained nodes and does not own its observers.

Parameters

initialOffset

initial non-negative finite logical displacement.

Constructors

Link copied to clipboard
constructor(initialOffset: Double = 0.0)

Properties

Link copied to clipboard

Current immutable geometry and position snapshot.

Functions

Link copied to clipboard

Installs one runtime observer and returns its owner-confined idempotent release handle.

Link copied to clipboard
fun scrollBy(delta: Double): Double

Moves by delta logical pixels and returns the resulting offset.

Moves from a runtime input handler while suppressing feedback to its originating node.

Link copied to clipboard
fun scrollTo(offset: Double): Double

Moves to offset logical pixels and returns the clamped resulting offset.

fun scrollTo(offset: Double, origin: ScrollStateObserver): Double

Moves from a runtime input handler while suppressing feedback to its originating node.

Link copied to clipboard
fun updateGeometry(viewportExtent: Int, contentExtent: Int, origin: ScrollStateObserver)

Publishes measured geometry while suppressing feedback to the originating area observer.