How so I enable Scroll zoom on MapKit JS?

I was wondering if anyone had any luck figuring out how to enable mouse scrolling to zoom on MapKit JS.


I've tried isZoomEnabled but nothing seems to work. I did notice that if I hold down Shift and scroll it works, but would rather users not have to press shift to Scroll.


Thanks!

Replies

Did you figure this out? I dont see any options exploring the maps functions to allow this to be enabled.

No luck so far. Any chance you figured it out? Not sure where we can get any help / support either :-/


Edit: Realized in the first post I forgot to mention I tried isScrollEnabled too

Seems to be a problem using Microsoft Windows clients. My browsers on macOS High Sierra (Chrome, Firefox and Safari) are able to scroll and zoom with default map settings, on Windows only possible using IE (while touch is working!). I was not able to make it working there. Probably some Beta-bug.

I have found the same problem with Windows Chrome and Firefox. The Chrome browser dev console gives me the warning:

[MapKit] Rotation can't be enabled because it's not available.


Some help from Apple would be great.

The maps developers just need to remove `if (t.shiftKey && !t.ctrlKey)` from their wheel event handler. Then it will work normally.

Still nothing about this issue ?

@jeremygottfried is right, it works when holding down shift key. Not acceptable for regular users, tho.


For now, I'm using a custom script to enable the mousewheel zoom as desired.

If anyone is interested, I've put it in a gist:

https://gist.github.com/Mwni/0faf2cc41032c30ad6d492998dee8174

Weirdly holding shift doesn't work with my mouse at all (logitech), but touchpad on laptop works fine.

Does it works on Safari on MacOS ?

This is frustrating. I started using google maps instead to avoid this issue with the apple mouse. It works as expected and scroll zooms on google maps.
I noticed that the npm library "apple-mapkit-js" is no longer maintained and also not an official release from Apple. Therefore the updates of the past two years are not available (including the mousewheel scrolling). Instead you should load the library via the script tag.

See here how to include the map.
I forgot to mention that it is also necessary to set

Code Block
map._allowWheelToZoom = true;

so that you can zoom with the mouse.

Now it is 2023, with latest mapkit Version 5.75.47, you can map._allowWheelToZoom = true;