Adding bamnet to the answer and maybe it will be useful for someone. This is not an answer in itself, because it has already been answered, but I had almost the same problem. In my case, the conflict was between drag and redraw.
When the user drag and drop the marker too far for the map to be expanded. Therefore, downtime will be called somewhere in the middle of the drag and drop process, as a result of which the moving marker will be placed at the starting point. To avoid this, I used the same approach proposed by bamnet, but using dragstart and dragend , for example the following:
markerDrag = false; google.maps.event.addListener(map, 'idle', function() { if(!markerDrag) { updateMap(); } }); google.maps.event.addListener(marker, 'dragstart', function() { markerDrag = true; }); google.maps.event.addListener(marker, 'dragend', function() {
I hope this will be helpful to someone.
source share