-
-
Notifications
You must be signed in to change notification settings - Fork 932
Description
User Story
As a developer using maplibre-gl-js, I want camera animations to smoothly cap their duration instead of becoming instant when exceeding a limit, so that transitions remain predictable and pleasant.
Rationale
FlyToOptions currently supports duration and maxDuration.
When the internally calculated duration exceeds maxDuration, the animation is forced to 0 ms. This behavior results in abrupt jumps instead of a shortened animation.
A more intuitive option would be to clamp the duration to a maximum value.
To maintain backwards compatibility, a new optional field could be added:
clampDuration?: numberIf provided, the animation duration becomes:
duration = min(calculatedDuration, clampDuration)
This avoids the “jump to instant” effect while preserving existing maxDuration semantics.
Impact
Without this option, developers cannot easily ensure smooth transitions when animations exceed a desired maximum duration. A clampDuration field would improve UX for applications relying on consistent camera movement, without breaking existing code.