AnsweredAssumed Answered

Map click on/off through button.

Question asked by endlessdsire on Jun 13, 2016
Latest reply on Jun 13, 2016 by endlessdsire

Hello,

 

I have a toggle button that i need to use for handling the map click. I have the following code but i cannot disable the map click for some reason.

I searched already in the working with events page and i dont know what im missing.

 

My code is:

 

onToggleButtonClick(e){
    var map = this.props.themap;
    var map_click_handle;

//enable the map click and get the geometry point
    if (this.state.toggleCliente =='OFF'){
      this.setState({toggleCliente: 'ON'});
      $('.factigis_btnSelectCliente').css('color',"crimson");


      map_click_handle = dojo.connect(map, 'onClick', (g)=>{
        console.log("My click", g);
      });
     
    //disable the map click to not get the geometry point.
    }else{
      this.setState({toggleCliente: 'OFF'});
      $('.factigis_btnSelectCliente').css('color',"black");

      dojo.disconnect(map_click_handle);
    }
  }

Outcomes