LavaUI docs GitHub

enum ScrollRouter

Swift

enum ScrollRouter

Wheel routing. The node under the pointer receives the wheel, focused or not — that is what every desktop app does, and it means scrolling a panel does not steal focus from a field.

Unlike hover and click, delivery bubbles: the caller supplies the whole ancestor chain under the pointer (LayoutHost.hitTestScrollChain) and the first eligible handler wins. Routing to the single topmost hit instead meant any interactive child — a button, a text field — silently swallowed the wheel for the ScrollView around it.

Sources/LavaUI/Focus.swift:399

Properties

nonisolated(unsafe) static var controlHeld: Bool { get }

Control, likewise: Ctrl+wheel is zoom in every reader and browser, and a handler that has to watch key events to know that is one that gets it wrong the first time the window loses focus mid-press.

Sources/LavaUI/Focus.swift:414

nonisolated(unsafe) static var shiftHeld: Bool { get }

Modifier state carried on the scroll event, so handlers do not have to track key state themselves.

Sources/LavaUI/Focus.swift:410

Methods

@discardableResult static func deliver(to chain: [NodeID], dx: Float, dy: Float, mods: Int32 = 0) -> Bool

Delivers to the innermost node in chain that has a handler willing to take this notch. Returns true if consumed.

Sources/LavaUI/Focus.swift:446

@discardableResult static func deliver(to target: NodeID?, dx: Float, dy: Float, mods: Int32 = 0) -> Bool

Single-node delivery, for callers that resolved one target themselves.

Sources/LavaUI/Focus.swift:464

static func register(_ id: NodeID, canScroll: ((Float, Float) -> Bool)? = nil, handler: @escaping (Float, Float) -> Void)

canScroll is the nested-scroll policy: a container already pinned at its end reports false and the notch continues out to the next eligible ancestor, so an inner list that cannot scroll farther does not deadlock the outer one. Omit it to consume unconditionally.

Sources/LavaUI/Focus.swift:420

static func unregister(_ id: NodeID)

Removes id's wheel handler.

Sources/LavaUI/Focus.swift:429