Skip to content

How to get the layer which drawn with pm.enableDraw and how to add event code on that layer? #887

Discussion options

You must be logged in to vote

You can use the event pm:create to listen for new created layers:

that.mymap.on('pm:create',(e)=>{
    var layer = e.layer
    // now you can add listeners
   layer.on('pm:dragend',(x)=>{console.log('Layer dragged');});
});

Or you can get all Layers with that.mymap.pm.getGeomanDrawLayers()

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Falke-Design
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #886 on May 06, 2021 08:32.