Skip to main content

Module camera

Module camera 

Source
Expand description

Pure-Rust camera math — what happens to (centre_lon, centre_lat, zoom) when the user pans by some pixel delta or zooms by some scroll delta?

Extracted from MapController and the demo wirings so it’s testable without spinning up a Slint runtime, and so anyone writing their own controller (e.g. for the MapEmbed embedding case) can reuse the same primitives.

All inputs/outputs are in geographic degrees + pixel space. The Web Mercator projection lives in crate::projection.

Functions§

pan
Apply a pan: the user dragged the visible map by (dx_px, dy_px) pixels. Returns the new camera centre.
zoom_anchored
Apply a zoom change anchored at a viewport pixel.