简体   繁体   中英

Google Maps Marker double click zooming map

I have placed several makers on a Google map, as follows -

var newMarker = new google.maps.Marker({ position: somePosition,
               map: map,
               title: 'My Marker',
               draggable: true
           });

and set up a number of listeners on the markers; click, dblclick, dragend & rightclick -

google.maps.event.addListener(newMarker, 'dblclick', function (evt) {
               doStuffWith(newMarker);
           });

This all works, my problem is that when I double click my markers, the map also zooms in. I'd like the map to zoom in when you double click the map only, if I double click a marker I'd like my listener event to fire & the map NOT to zoom.

Is this possible ? Thank you.

You can add

disableDoubleClickZoom: true

to the map options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM