Select to view content in your preferred language

Deactivate measurements when closing panel

706
2
Jump to solution
08-15-2017 06:34 AM
JohnDenis
Deactivated User

I found this script on GeoNet where all the buttons and measurements created in the Measurement Widget are automatically closed when closing the Measurement panel. 

I am trying to duplicate this behaviour on a Calcite theme JSBin but the widget is still active when closing it's panel:

var titlePane = dijit.byId("panelMeasure");
titlePane.on("hide", function(){
  measurement.setTool("location",false);
  measurement.setTool("area",false);
  measurement.setTool("distance",false);
  app.map.graphics.clear();
})

Am I missing something in these code lines?

John

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

John,

  This is what you need then:

      // Deactivate Measurement widget on panel close
      query("#panelMeasure").on("hide.bs.collapse", function(e) {
        app.measurement.setTool("location", false);
        app.measurement.setTool("area", false);
        app.measurement.setTool("distance", false);
        app.map.graphics.clear();
      });

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

John,

  This is what you need then:

      // Deactivate Measurement widget on panel close
      query("#panelMeasure").on("hide.bs.collapse", function(e) {
        app.measurement.setTool("location", false);
        app.measurement.setTool("area", false);
        app.measurement.setTool("distance", false);
        app.map.graphics.clear();
      });
JohnDenis
Deactivated User

Thank you 

0 Kudos