InteractiveViewer

An image inspection screen needs to move and magnify the same content, not rebuild a different image for each gesture. InteractiveViewer puts one retained child behind a two-dimensional camera. Use it for maps, diagrams, and image inspection; use InfiniteCanvas when nodes, connections, selection, and committed geometry belong to the app.
The widget is available with the desktop, android, ios, mobile, and web Fission features. It is intentionally absent from Static site, SSR, and Terminal-only builds.

Example

use fission::prelude::*;

fission_component! {
    pub FloorPlanViewer<()> {
        props { asset_path: String }
    }
    view(plan, _state, _cx) =>
    InteractiveViewer(
        child: Image::asset(plan.asset_path.clone()),
        min_scale: 0.25,
        max_scale: 8.0,
        pan_axis: ViewportPanAxis::Both,
        zoom_policy: ViewportZoomPolicy::WheelWithModifier,
    )
}
The parent supplies an asset registered by the app, for example FloorPlanViewer(plan.asset_path.clone(), key: plan.id.clone()). The key keeps transient camera state attached to that plan. The scale limits are inspection limits, not a substitute for giving the viewport bounded layout space.
With transform: None, Fission owns transient pan, pinch, magnification, wheel, and inertial state. Set transform: Some(...) when application state is authoritative. initial_transform only seeds an uncontrolled viewer.

Interaction callbacks

The on_interaction_start, on_interaction_update, and on_interaction_end envelopes keep their bound payload. Live camera facts arrive separately through ctx.input.viewport_interaction():
•
target WidgetId and lifecycle phase;
•
complete ViewportTransform;
•
viewport and world focal points;
•
pan delta and multiplicative scale factor;
•
input family and active modifiers.
This lets one reducer bind stable document context without encoding runtime coordinates into its action value.

Behavior

•
A single primary pointer pans after the movement threshold.
•
Two contacts pan and pinch around their centroid. Adding a second contact cancels a pending child tap or drag and captures the nearest viewer.
•
Releasing one of two contacts resets the baseline, avoiding a camera jump.
•
macOS magnification gestures and Web browser pinch gestures zoom around their focal point.
•
Modifier-wheel zoom and unmodified wheel pan follow zoom_policy and pan_axis.
•
boundary, min_scale, and max_scale are enforced by the shared runtime, independent of renderer.
•
clip controls whether transformed content is clipped at the viewport edge.
Interactive descendants win a single-pointer drag. Multi-touch remains reserved for the nearest viewer so pinch gestures are reliable around draggable children.