FilamentViewState

Hoisted handle to a FilamentView's live Filament objects. Create with rememberFilamentViewState, pass to a FilamentView, and use it for imperative access — picking, reading the viewport, or reaching the raw View/Renderer for advanced work.

view and renderer are null until the state is attached to an on-screen FilamentView, and become null again when that view leaves composition.

val viewState = rememberFilamentViewState()
FilamentView(scene = scene, viewState = viewState, ...)

// Pick on tap — pick() takes Compose coordinates (top-left origin), no flipping needed:
Modifier.pointerInput(Unit) {
detectTapGestures { offset ->
viewState.pick(offset.x.toInt(), offset.y.toInt()) { result -> ... }
}
}

Properties

Link copied to clipboard
Link copied to clipboard
var view: View?

Functions

Link copied to clipboard
fun pick(x: Int, y: Int, onResult: (View.PickingQueryResult) -> Unit)

Issues a Filament picking query at viewport pixel (x, y) in Compose coordinates (origin top-left, like pointer-input offsets) and delivers the result to onResult on the render thread. The conversion to Filament's bottom-left viewport origin happens internally. No-op while not attached.