Measurement Widget and Popups

3554
2
Jump to solution
11-10-2015 09:43 AM
AshleyPeters
Occasional Contributor III

I've added in the measurement widget to my project, but now I am trying to turn the pop-ups off while the widget is in use. I've tried the different solutions that have been mentioned in other forum threads on this topic without any luck. I'm still pretty new to the JavaScript API, so I imagine this is a much easier fix than I'm making it out to be.

Here's an example of one of my infoTemplates, should that be helpful in resolving this:

//Create Trails InfoTemplate
var trailsInfoTemplate = new InfoTemplate();
trailsInfoTemplate.setTitle("<b>${Trail_Name}</b>");
var trailsInfoContent =
 "<div class=\"InfoContent\">" +
 "Trail Type: ${Trail_Type}<br><br>Located On: ${Tract}<br><br>Length (mi.): ${Mileage}"
 + "</div>";
 
trailsInfoTemplate.setContent(trailsInfoContent);

Here's the measurement widget portion of my project:

var snapManager = mapMain.enableSnapping({
      snapKey: has("mac") ? keys.META : keys.CTRL
    });
    var layerInfos = [];
    snapManager.setLayerInfos(layerInfos);
    var measurement = new Measurement({
      map: mapMain
    }, dom.byId("measurementDiv"));
 measurement.startup();

					
				
			
			
				
			
			
				
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Ashley,

  You can disable the popups using aspect after

var measurement = new Measurement({ 
  map: mapMain 
}, dom.byId("measurementDiv")); 
aspect.after(measurement, 'setTool', function() {
  if (measurement.activeTool) {
    mapMain.setInfoWindowOnClick(false);
  } else {
    mapMain.setInfoWindowOnClick(true);
  }
});
measurement.startup();

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Ashley,

  You can disable the popups using aspect after

var measurement = new Measurement({ 
  map: mapMain 
}, dom.byId("measurementDiv")); 
aspect.after(measurement, 'setTool', function() {
  if (measurement.activeTool) {
    mapMain.setInfoWindowOnClick(false);
  } else {
    mapMain.setInfoWindowOnClick(true);
  }
});
measurement.startup();
0 Kudos
AshleyPeters
Occasional Contributor III

Thanks Robert! I hadn't seen that solution in previous threads. Worked perfectly!

0 Kudos