Module image_viewer
Expand description
Interactive image viewer with pan + zoom semantics, unlike the static
crate::widget::Image widget: scroll-wheel zoom, click-drag pan, and
a deterministic “fit to viewport” reset. Interaction state (zoom, pan,
drag origin) lives on the widget directly; CRDT reflection is out of scope.
Coordinate model: zoom == 1.0 is the “contain” baseline (mirrors CSS
object-fit: contain). Higher zooms multiply that baseline scale, and
pan is an image-space offset applied after it — storing pan in image
space rather than pixels keeps drag velocity constant across zooms.
Scroll-wheel zoom centres on the cursor by re-projecting the image-space
point under it before/after the scale change and nudging pan to keep
that point fixed on screen — otherwise zooming “to a feature” would feel
like the image sliding away from the pointer.
Structs§
- Image
Viewer - Interactive viewer for a pre-decoded
peniko::ImageData. See module docs for the contract. - Image
Viewport - Pure photo viewport geometry shared by live widgets and immutable History.