pub fn Viewport(props: ViewportProps) -> impl IntoViewExpand description
A render surface backed by a web worker. On mount it sizes a canvas to the
device pixel ratio, transfers it to an OffscreenCanvas, spawns the module
worker at worker_url, and reports the Bridge, canvas, and dimensions through
on_connect. It forwards pointer, wheel, touch, and resize events as
ViewportEvents to on_input, worker messages to on_message, failures to
the optional on_error, and toggles the grabbing signal during pointer
interaction.
§Required Props
- worker_url:
impl Into<String> - grabbing:
RwSignal<bool> - on_input:
Callback<ViewportEvent> - on_connect:
Callback<(Bridge, OffscreenCanvas, f32, f32)> - on_message:
Callback<JsValue>
§Optional Props
- on_error:
Callback<String>