With Google Maps JS API v3, I want to drop a marker where the user clicks the map, while the default is Keeping behaviors when the user double-clicks (and do not add any markers on the map).
I thought about defining an end time on click event. If a double click event is triggered in the next few milliseconds, the timeout is canceled. If not, the marker is placed on the map when the expiration period expires.
Thanks
Thank you.
Thanks
Thank you.
The easiest way to solve it
var location; Var map ... ... google.maps.event.addListener (map, 'click', function (event) {mapZoom = map.getZoom (); startLocation = event.latLng; setTimeout (placemarker, 600);}); Function Place Marker () {if (mapZoom == map.getZoom ()) {new google.maps.Marker ({status: location, map: map}); }} The solution is better (see below)
Comments
Post a Comment