Skip to content

Adding hover effect on Drawn shape #1075

Discussion options

You must be logged in to vote

No not over setPathOptions but over the pm:create event:

map.on('pm:create',(e)=>{
   var layer = e.layer;
   layer.on({
	mouseover: highlightFeature,
	mouseout: resetHighlight,
   });
});

function highlightFeature(e){
   e.target.setStyle({color: 'red'});
}


function resetHighlight(e){
   e.target.setStyle({color: '#3388ff'});
}

Replies: 1 comment

Comment options

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