i have a button on my project, the button must have a capability to enter the drawing mode and user can drawing and pick point after clicking the button. if the drawing or pickpoint is done, user can click the button again to exit the drawing mode and disable the screenSpaceEventHandler. i tried to use the state variable on-off like this below but it still can pick point when the eventHandler is destroyed. any idea to solve this? thanks in advance
let eventHandler = new ScreenSpaceEventHandler(
this.terria.cesium.scene.canvas
);
if (this.inDrawMode === true){
this.inDrawMode=!this.inDrawMode
console.log("indrawmode is ", this.inDrawMode,"mode drawing");
eventHandler.setInputAction(
function startLook(){console.log(8)},
ScreenSpaceEventType.RIGHT_CLICK
);
}
else if (this.inDrawMode === false) {
this.inDrawMode=!this.inDrawMode
console.log("indrawmode isS ", this.inDrawMode,"destroymode");
eventHandler.destroy();
}
by the way i wrote this in typescript