Skip to content

how to check if geoman editing is enabled #1543

Closed Answered by Falke-Design
udos asked this question in Questions & Help
Discussion options

You must be logged in to vote

The easiest is to check if one of the modes is enabled:

const modeEnabled = map.pm.globalCutModeEnabled() || map.pm.globalDragModeEnabled() || map.pm.globalDrawModeEnabled() || map.pm.globalEditModeEnabled() || map.pm.globalRemovalModeEnabled() || map.pm.globalRotateModeEnabled()

You can set a flag with listening on the toggle events:

let modeEnabled = false;
map.on('pm:globalcutmodetoggled pm:globaldragmodetoggled pm:globaldrawmodetoggled pm:globaleditmodetoggled pm:globalremovalmodetoggled pm:globalrotatemodetoggled ', ()=>{
  modeEnabled = map.pm.globalCutModeEnabled() || map.pm.globalDragModeEnabled() || map.pm.globalDrawModeEnabled() || map.pm.globalEditModeEnabled() || map.pm.globa…

Replies: 1 comment

Comment options

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