MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
mln_momentum_decay Struct Reference

#include <map.h>

Data Fields

mln_momentum_decay_fields fields
mln_momentum_decay_model model
double half_life_ms
double stop_speed
double distance
double duration_ms
mln_unit_bezier easing
double min_speed
double max_speed
double max_distance

Detailed Description

How one part of a gesture's momentum slows from its release speed.

Speeds and distances are in the part's unit: logical pixels for pan, zoom levels for zoom, and degrees for bearing and pitch. A setting whose bit isn't set takes the part's default, which mln_gesture_momentum lists. min_speed is finite and not negative, and every other number is finite and positive. A friction decay can serve every release, as a preset that matches a platform's scrolling. An eased glide takes its direction from the part's velocity, and its distance and duration from the caller's plan.

Field Documentation

◆ distance

double mln_momentum_decay::distance

Required for MLN_MOMENTUM_DECAY_MODEL_EASE.

◆ duration_ms

double mln_momentum_decay::duration_ms

Required for MLN_MOMENTUM_DECAY_MODEL_EASE.

◆ easing

mln_unit_bezier mln_momentum_decay::easing

For MLN_MOMENTUM_DECAY_MODEL_EASE, the share of distance covered over the share of duration_ms. Its control points are between 0 and 1, so the glide never passes its distance. Defaults to (0, 0, 0.25, 1), the curve that camera animations ease along by default. Android's scroll fling follows (0.175, 0.5, 0.35, 1).

◆ fields

mln_momentum_decay_fields mln_momentum_decay::fields

◆ half_life_ms

double mln_momentum_decay::half_life_ms

For MLN_MOMENTUM_DECAY_MODEL_FRICTION, how long the speed takes to halve.

◆ max_distance

double mln_momentum_decay::max_distance

The farthest the part moves. A friction release that would move farther starts slower, so it ends sooner, and a planned glide moves at most this far over its duration.

◆ max_speed

double mln_momentum_decay::max_speed

For MLN_MOMENTUM_DECAY_MODEL_FRICTION, a faster release counts as this.

◆ min_speed

double mln_momentum_decay::min_speed

A slower release starts no momentum.

◆ model

mln_momentum_decay_model mln_momentum_decay::model

◆ stop_speed

double mln_momentum_decay::stop_speed

For MLN_MOMENTUM_DECAY_MODEL_FRICTION, the speed at which it ends.


The documentation for this struct was generated from the following file: