Leaflet / Leaflet

πŸƒ JavaScript library for mobile-friendly interactive maps πŸ‡ΊπŸ‡¦
https://leafletjs.com
BSD 2-Clause "Simplified" License
40.17k stars 5.75k forks source link

Allow configuration of duration multiplier for flyTo #9301

Open TheNumenorean opened 1 month ago

TheNumenorean commented 1 month ago

Checklist

Motivation

I really like the flyTo animation, but it can be too slow (>8 seconds). It is configurable with duration, but that doesnt scale to the distance, so it can be too fast or too slow.

Suggested solution

Add a "durationMultiplier" option to PanOptions, which when present replaces the .8 here.. And/or add a "maxDuration" option to PanOptions which when present is used as an upper-bound on the number generated by the above linked line.

Alternatives considered

I could calculate the duration myself based on distance, but I would essentially have to duplicate the calculations the function is doing.