Posts by eivindml

All posts

Apple MapKit JS: How to enable zoom on scroll?

I really like Apple's MapKit JS. Great privacy (so good that DuckDuckGo recently moved away from OpenStreetMap to MapKit), good design, and good developer experience.

Working on a project, where I was displaying a map in fullscreen, I wanted to be able to zoom using the mouse scroll wheel. It doesn't support this with default configs. After looking at their documentation, I found the `isScrollEnabled` boolean, which looks like it should be what I'm looking for.

A Boolean value that determines whether the user may scroll the map with a pointing device or with gestures on a touchscreen. [Apple]

Unfortunately it didn't change anything it looks like. But after some more digging around, I found that there is actually and undocumented private API that fixes this.

map._allowWheelToZoom = true;

It's so undocumented that if you Google the exact phrase, you get two results.

Which almost makes it a Googlewhack example.