Expand description
The camera: its options, momentum and limits, bound options, the transform that moves it, the transform state, and the view it shows and draws with.
Re-exports§
pub use transform::CameraCommandId;pub use transform::CommandEnd;pub use transform::FrameClock;pub use view::NorthOrientation;pub use view::View;pub use view::scale_zoom;pub use view::zoom_scale;
Modules§
- constants
- The camera’s limits: its pitch, field of view and zoom.
- transform
- The map’s camera: the commands, animations, gestures and momentum that move it within its limits.
Structs§
- Anchored
Momentum - How a gesture’s zoom, bearing or pitch keeps changing after release.
- Animation
Options - Various options for describing a transition between viewpoints with animation. All fields are optional; the default values depend on how this struct is used.
- Bound
Options - Holds options to limit what parts of a map are visible. All fields are optional.
- Camera
- A camera with every member set: the camera that a map has, where
CameraOptionsis a change to one. - Camera
Delta - A change to the camera from where it is now, as a gesture makes it
(the C API’s
mln_camera_delta). - Camera
Limits - The limits a map’s camera moves within.
- Camera
Momentum - Camera motion that continues a gesture after its last contact lifts.
- Camera
Options - Various options for describing the viewpoint of a map. All fields are optional. A partial command replaces animations of its specified fields. Omitted fields keep their original animation timing. Flights couple center and zoom; anchored commands couple center with their specified fields. Replacing any member of a coupled group stops that group. Anchor and center points are mutually exclusive, with preference for the center point when both are set.
- Camera
Update - Moves the camera to absolute values, as the C API’s
mln_camera_updatedoes: the counterpart ofCameraDeltafor commands and gestures that know where the camera should go. - Camera
Velocity - How fast each part of a camera change moves, in its own unit per second.
- Center
AndBearing - Frame
Projection - Where a frame drew the map, and the depth its 3D layers wrote there.
- Free
Camera Options - Various options for accessing physical properties of the underlying camera
entity. A direct access to these properties allows more flexible and
precise controlling of the camera while also being fully compatible and
interchangeable with
CameraOptions. All fields are optional. - Invalid
Momentum - Why a momentum setting is out of range.
- Logical
Extent - A size in logical pixels, and the physical pixels in each logical pixel.
- MapProjection
- Converts coordinates for one camera and size, without a map: on the
ground a renderer drew of a terrain (
with_ground), or else on the flat map. It holds only a transform state and the ground, so it can move to another thread. - MapView
- One view of a map: its camera, size, and projection.
- Momentum
Decay - How one part of a release glides, in the part’s unit: logical pixels for pan, zoom levels for zoom, and degrees for bearing and pitch, with speeds per second.
- Momentum
Easing - A unit cubic Bézier, from (0, 0) to (1, 1), with these control points.
- Momentum
Glide - How one part glides after release: from
velocity, per second, bydecay. A pan’s decay applies to its speed. - Momentum
Snap - Where a part settles once its glide ends: on the nearest of the targets
every
spacingfromoffset, when it is withintoleranceof one. Bearing targets lie within one turn fromoffset, and the bearing takes the shorter way around to the nearest. - Projected
Tile Point - A tile point in clip space, as the vertex shaders would place it.
- Projection
Data - Projection
Mode - Holds values for Axonometric rendering. All fields are optional.
- Tile
Coordinate - Has floating point x/y coordinates. Used for computing the tiles that
need to be visible in the viewport. In mapbox-gl-js, this is named
MercatorCoordinate. - Tile
Projector - Projects the points of one tile through the current projection, the way the vertex shaders do it.
- Transform
State - A map’s camera with the limits that constrain it: the
Viewit shows now, and the bounds, zoom, pitch and field of view it may move within. - Transition
End - How a camera command ended, once every field of it has: completed,
cancelled, replaced by later commands, or closed with the map. Other
commands may still be animating. It replaces C++’s
transitionFinishFn, which can’t tell those apart; the C API reports the same outcomes. - Vertical
Perspective Projection - The globe: tile geometry projected onto a unit sphere, viewed with a
vertical perspective camera. Port of MapLibre GL JS
vertical_perspective_transform.ts. - View
- One view of a map: its camera, size and projection, and the matrices it draws with. A view never changes: a map that moves its camera makes a new one.
- Viewport
- How a map orients and constrains its view.
Enums§
- Axonometric
Mode - Whether axonometric rendering is enabled.
- Camera
Error - Why a
CameraDeltawas rejected. - Camera
Update Mode - How
CameraUpdatemoves the camera. - Clip
Depth Range - How a graphics API’s clip space holds depth.
- Constrain
Mode - We can choose to constrain the map both horizontally or vertically, only vertically e.g. while panning, or screen to the specified bounds.
- Gesture
Phase - Where a camera change stands in a gesture, as the C API’s
mln_gesture_phasedefines it.BeginandUpdatemark a gesture in progress, andEndandCancelend it; a gesture whose end starts momentum stays in progress until the momentum ends. - Momentum
Decay Model - How a glide unfolds from its release speed.
- Projection
- How a
Viewplaces tiles on the screen. Both variants project locations onto the same Mercator plane, so the tile-to-world matrix ismercator_tile_matrixon either. - Transition
Outcome - How a camera command ended, as the C API’s
mln_camera_transition_outcomereports it. A command that ended in more than one way reportsCancelledif any of it was cancelled, otherwiseClosedif any of it was closed, and otherwiseReplacedif any of it was replaced. - Viewport
Mode - Satisfies embedding platforms that requires the viewport coordinate systems to be set according to its standards.
Constants§
- MAX_
FIELD_ OF_ VIEW - The widest field of view a camera may take, in radians.
- MIN_
FIELD_ OF_ VIEW - The narrowest field of view a camera may take, in radians.
Traits§
- Elevation
- The ground of a terrain as a frame drew it, which the map’s camera stands on. A renderer makes it and hands it to the map; it doesn’t change once made, so the map reads it on its own thread.
Functions§
- scale_
zoom - The zoom of
scale: its base-2 logarithm. - zoom_
scale - The scale of
zoom: 2 to its power.