You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My impression was that some users were using rachety zooming to avoid some calculations on fractional zoom changes. Is that not your understanding, @mourner?
@lucaswoj I don't think there's a significant performance difference between a frame when zooming and a frame when panning. Fractional vs integer zoom levels shouldn't affect performance as well.
@tmcw can you elaborate more on use cases and how that would work exactly? Would it be completely discrete snapping (one frame per integer zoom), or animated zooming between integer zooms that you can't stop?
The ArcGIS API is one example - There's another scroll-zooming example I can dig up that snapped to integer zoom levels. Every example I've seen so far supports animated zoom but then snaps to a level, and I'm pretty sure that it's about two things:
@geojs i wanted rachety zoom mode because i am using dynamic map service and mapbox aggregively fetches data during factional zoom... i disabled zoom scroll which made api fetch calls more friendly
map.scrollZoom.disable();
user expecirece was bad while using map.setZoom so i prefered disabling zoom scroll
Thanks
Activity
lucaswoj commentedon Nov 11, 2015
👍
{ ratchety: true, ... }[-]Ratchety-zoom mode[/-][+]Support a ratchety-zoom mode[/+]lucaswoj commentedon Jul 29, 2016
A note for context: the biggest advantage (in my mind) of enabling "ratchety zoom" is improving rendering performance.
mourner commentedon Jul 29, 2016
How would this improve rendering performance?
lucaswoj commentedon Jul 29, 2016
My impression was that some users were using rachety zooming to avoid some calculations on fractional zoom changes. Is that not your understanding, @mourner?
mourner commentedon Jul 31, 2016
@lucaswoj I don't think there's a significant performance difference between a frame when zooming and a frame when panning. Fractional vs integer zoom levels shouldn't affect performance as well.
The only use case I can think of for snapping to integer zoom levels is compatibility with stuff like Leaflet, but e.g. https://github.com/mapbox/mapbox-gl-leaflet doesn't need a GL JS option for that because it synchronizes based on its own events.
@tmcw can you elaborate more on use cases and how that would work exactly? Would it be completely discrete snapping (one frame per integer zoom), or animated zooming between integer zooms that you can't stop?
tmcw commentedon Jul 31, 2016
The ArcGIS API is one example - There's another scroll-zooming example I can dig up that snapped to integer zoom levels. Every example I've seen so far supports animated zoom but then snaps to a level, and I'm pretty sure that it's about two things:
zavan commentedon Oct 25, 2016
"Making raster imagery look nice, maybe? Since you don't have over or under-scaled images?"
That is the point for me.
PS.: Do you have those hacks? I need them for now...
lucaswoj commentedon Oct 25, 2016
@zavan You can use some iteration of this to get the behavior you're looking for:
aliir74 commentedon Jan 20, 2019
Do you support this feature now? The set zoom function sharply shakes map and isn't good for me.
vwong commentedon Jan 23, 2019
This worked for me:
HarelM commentedon Mar 29, 2019
@vwong I assume your solution will not work when using the
fitBoundsfunction, right?So the only valid workaround is to use @lucaswoj answer?
vwong commentedon Mar 31, 2019
@HarelM It should work. Here's a fuller version of my example. Works on touch devices too.
In my use case, I needed to turn ratchet on/off depending on other external factors. Good luck!
geoyogesh commentedon May 1, 2019
this snippet will cause
ERROR RangeError: Maximum call stack size exceeded
geojs commentedon Mar 2, 2021
@geoyogesh to not have the ERROR RangeError:
geoyogesh commentedon Mar 2, 2021
@geojs i wanted rachety zoom mode because i am using dynamic map service and mapbox aggregively fetches data during factional zoom... i disabled zoom scroll which made api fetch calls more friendly
map.scrollZoom.disable();
user expecirece was bad while using map.setZoom so i prefered disabling zoom scroll
Thanks
IgnacioHeredia commentedon Oct 13, 2021
As far as the wheel zoom is concerned, you are probably looking for:
after starting from an integer zoom level.