How to close opened draw control? #1558
-
Hey! I'm creating a custom draw control based on Marker one but with a custom modal that opens before the actual marker placement. No matter what's inside the modal, there is also a "Cancel" button in this modal so user can cancel entire operation. My current code looks as follows: this.map.pm.Toolbar.copyDrawControl("Marker", {
name: "Object",
block: "draw",
title: "Place an object",
onClick: (e, ctx) => {
// Pause drawing until next logic steps are resolved, we don't want to have both modal opened
// and marker drawing icon flying around when user is using the modal
const result = open_modal()
if (result === true) {
do_something and continue with default marker drawing logic
} else {
// result is `false` which means user clicked `Cancel` in the modal and i want to
// close the Control subpanel as well, equivalent of clicking "Cancel" action for Marker menu
}
},
}); As comment states, i want to close the Control submenu on specified condition - can anyone please point me into the right direction how to approach that? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
When you call |
Beta Was this translation helpful? Give feedback.
-
The solution @Falke-Design gave above did not helped me but what did helped me was using:
|
Beta Was this translation helpful? Give feedback.
The solution @Falke-Design gave above did not helped me but what did helped me was using: