google maps API v3 events -
i have following situation:
a polyline added on map , when user clicks on state changes editable. have event if user clicks last vertext of polyline , starts moving mouse able extend polyline mouse path user drawing.
however seems when have event , inside event try add 1 not work , don't kwow why.
just in case make things simpler undrstand paste part of code.
google.maps.event.addlistener(polyline, "mousedown", function(event){ if(polyline.geteditable() === true) { if(typeof event.vertex !== "undefined") { if(event.vertex === polyline.getpath().getlength() - 1) { polyline.seteditable(false); if(mousemovedrawingevent === null) { map.setoptions({draggable:false}); polyline.setoptions({clickable:false}); mousemovedrawingevent = google.maps.event.addlistener(map, "mousemove", function(event) { alert("1"); // <== never fires polyline.getpath().push(event.latlng); drawinglabel.setpoint(event.latlng); drawinglabel.setcontents("<div style='background-color:white'>" + (google.maps.geometry.spherical.computelength(polyline.getpath()) / 1000).tofixed(2) + " ΠΊΠΌ.</div>"); }); } map.getdiv().onmouseup = function(ev) { polyline.setoptions({clickable:true}); map.getdiv().onmousedown = null; map.getdiv().onmouseup = null; google.maps.event.removelistener(mousemovedrawingevent); mousemovedrawingevent = null; }; } } } });
.....
thre event here listens 'mouseup'....
do guys have idea how make peace of code works.
i found solution questions.
the problem when set polyline {clickable:false} api removes event ( , everyhing inside it:)
Comments
Post a Comment