google maps - GoogleMaps API V3 Polygon dblclick auto-complete -


i have created plotting system using googlemaps javascript api v3, allows users draw out , save polygons.

i have received number of complaints concerning autocompletion of plots result of accidentally doubleclicking while manually drawing out points using polygon drawing tool. therefore looking disable dblclick auto-complete function, plots complete once user clicks on first point again.

i have tried unbinding dblclick event map, , attempted stop propagation of dblclick event throwing error on double click, below (just test event call).

google.maps.event.addlistener(map, 'dblclick', function(){      throw("stop"); }); 

this succeeds in stopping zoom function on doubleclick, autocomplete still occurs when dblclicking while plotting points (this listener not triggered). have tried stopping propagation of doubleclick event on whole page, no avail. can suggest either way of unbinding dblclick event, or alternative solution prevent dblclick autocomplete?

i have searched through api reference document , forums , have not been able find solution this.

add edit button after finish!

save polygons array on "overlaycomplete" (and add edit button @ same time)

var polyarray = [];  google.maps.event.addlistener(drawingmanager, 'overlaycomplete', function(e) {     this.setdrawingmode(null);     var shape   = e.overlay;     shape.type  = e.type;      polyarray.push(shape);          shape.addlistener('click', function(evt){             if (evt.vertex != null && this.getpath().getlength() > 3) {                 this.getpath().removeat(evt.vertex);             }         });       }); 

the edit function:

function editfeature(id, action){      var shape = polyarray[id];      if(action) shape.seteditable(true);           else shape.seteditable(false); } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -