|
MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
|
#include <map.h>
Data Fields | |
| double | duration_ms |
| double | velocity |
| double | min_zoom |
| uint64_t | transition_id |
| mln_camera_transition_handler | end_handler |
Optional animation controls for camera transitions.
| double mln_animation_options::duration_ms |
Duration in milliseconds. Must be finite, non-negative, and short enough to represent as a duration.
When omitted, ease transitions apply immediately. Fly transitions derive their duration from velocity.
| mln_camera_transition_handler mln_animation_options::end_handler |
Reports the end of the command's transitions. Disabled by default.
For each accepted command that carries an enabled handler, the callback runs exactly once, on the runtime worker, and release_user_data runs after it. A command ends when every MapLibre transition that it started has ended, so a camera delta that pans and zooms reports once, after both. A jump, a zero-duration transition, and a command that changes no camera field end right after the command applies.
The callback runs after the map events of the change that ended the transitions are queued, and never from inside a MapLibre Native call. A transition that a command ends reports before that command's completion runs. A transition that ends outside a command, as rendered frames advance it, reports from a later task on the runtime worker. When the map closes first, the callback runs with MLN_CAMERA_TRANSITION_OUTCOME_CLOSED before the release completes.
The callback may call any C API that a completion callback may call, including camera commands, but must return promptly. A rejected command runs neither callback and leaves user_data with the caller.
| double mln_animation_options::min_zoom |
Peak zoom for flyTo transitions.
| uint64_t mln_animation_options::transition_id |
Caller-chosen identity of the command that these options animate, which mln_map_cancel_camera_transition() matches.
The C API passes the value through without interpreting it, so callers pick their own scheme, such as a monotonically increasing counter. Several commands may share one identity. A command without this field matches no identity.
| double mln_animation_options::velocity |
Average fly velocity in screenfuls per second. Must be positive and finite; defaults to 1.2 when omitted. A flight whose derived duration is too long to represent fails its completion with MLN_STATUS_NATIVE_ERROR. An explicit duration overrides velocity.