geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers

Home Page:https://geoman.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pm:vertexadded event listener isnt triggered when placing a vertex with a rectangle.

BrandanDoesCode opened this issue · comments

https://jsfiddle.net/mpotq23b/1/

as shown in the above jsfiddle, the console .log for vertex added appears when using the polygon tool, however it does not work when using rectangle tool.

Please let me know if there is another way to detect if first point of recetangle has been placed

pm:vertexadded is currently not implement for Rectangle.

You can use this workaround:

map.on('pm:drawstart',(e)=>{
  if(e.shape === 'Rectangle'){
    map.pm.Draw.Rectangle._startMarker.on('move', ()=>{
      console.log('start Marker set')
    })
  }
})

This fix works awesome thank you !