1

I have a map and I'm listening a click event like this,

 currentMap.on("click",this.identifyMapFeature.bind(this));

At some extent I want to disable the click event from map, I've tried these 3 methods from esri js API docs,

    this.currentMap.disableMapNavigation();
    this.currentMap.disablePan();
    this.currentMap.disableScrollWheelZoom();

but still click event is firing , is there any method like disableMapClick() to disable map click ?

1 Answer 1

2

You can use dojo/on's pausable method to pause and resume any type of event. You will have to add the "dojo/on" module in your require statement.

require(["dojo/on"], function(on){
  var buttonHandler = on.pausable(button, "click", clickHandler);

  on(disablingButton, "click", function(){
    buttonHandler.pause();
  });

  on(enablingButton, "click", function(){
    buttonHandler.resume();
  });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.