FilamentViewState
class 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 (Filament's viewport origin is bottom-left, so flip Y):
Modifier.pointerInput(Unit) {
detectTapGestures { offset ->
val v = viewState.view ?: return@detectTapGestures
viewState.pick(offset.x.toInt(), v.viewport.height - offset.y.toInt()) { result -> ... }
}
}Content copied to clipboard