mercredi 1 septembre 2021

How to prevent browser window scroll to Google maps on map center change

I have a problem in both desktop and mobile Safari, and Chrome on iPhone. So as I understand, this is an iOS and Safari thing.

There's a slider of objects and a map displaying the object location. When slide is changed, map is re-centered to that object location:

this.map.panTo(this.mapMarkers[index].position);

The issue is that Safari also re-centers browser window to the newly set map center.

This is particularly bad on mobile, here's a video: https://www.youtube.com/watch?v=C_-WAEBJHXY

I've also tried using map.setCenter but the issue remains.

This behaviour isn't replicated in desktop (Mac) Chrome, neither in Chrome on Android devices.

Here's a link to see the issue: https://nv.invsbl.lt/studijos/testinis-marsrutas/

Is there a possibility to change this behaviour?

Thanks a lot in advance.




Aucun commentaire:

Enregistrer un commentaire