How to Catch Events when drawing a polygon on Google Maps Data Layer -


when drawing polygon on google maps data layer, want handle events when user draws first point, second , subsequent points ui can give different user guidance such as:

  • no points drawn : "click draw first point"
  • first point drawn: "click draw next point"
  • second point drawn: "click add point or click on first point end"

when closing point drawn on data layer using data library there 'addfeature' event. when final point drawn using drawing library there different events such polygoncomplete.

to see if events emitted first, second , subsequent points, used google sample code display events , modified handle drawing events on data layer. new events are:

'addfeature': 'data layer event',       'click': 'data layer event',       'dblclick': 'data layer event',       'mousedown': 'data layer event',       'mouseout': 'data layer event',       'mouseover': 'data layer event',       'mouseup': 'data layer event',       'removefeature': 'data layer event',       'removeproperty': 'data layer event',       'rightclick': 'data layer event',       'setgeometry': 'data layer event',       'setproperty': 'data layer event',       'circlecomplete': 'this event fired when user has finished drawing circle',       'markercomplete': 'this event fired when user has finished drawig marker',       'overlaycomplete': 'this event fired when user has finished drawing overlay of type',       'polygoncomplete': 'this event fired when user has finished drawing polygon',       'polylinecomplete': 'this event fired when user has finished drawing polyline',       'rectanglecomplete': 'this event fired when user has finished drawing rectangle' } 

http://jsfiddle.net/bunjil/gfp9qntx/9/

the event listener enhanced listen data layer events - not map events.

looking @ events fired, , checking documentation appears there no event adding points while drawing new polygon, mouseup event on data layer.

while possible count mouseup events, might not robust solution.

i can see there events on polygons , polylines when adding or moving vertices these seem exist once polygon created.

can confirm if understanding correct or if there events missing something.

there related question seems confirm there no events on data layer or map can listen mouse events on canvas. how can listen start of user drawing polygon in google maps v3?


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -