I’m noticing I have a slight bug when I’m using the PathMeasure and PolygonMeasure tools. The tool will measure as intended and give me the output correctly in the popup, however when I close the measure results popup the tool will “reset” and think that the close click was the first click in another measure. Is there something I can add to the js to ignore the close click so it won’t try to start a new measure? Here is my code:
function lineMeasureFunction()
{
deactivateToolbarIcon(‘iconAreaMeasure’);
deactivateToolbarIcon(‘iconZoomBox’);
if (iconLineMeasureActive == false)
{
iconLineMeasureActive = true;
Map1.setMeasureMode('PathMeasure');
document.getElementById('iconLineMeasure').src = "../Content/images/iconLineMeasure-hover.png";
document.getElementById('iconLineMeasure').style.border = "inset";
}
else
{
deactivateToolbarIcon('iconLineMeasure');
}
return false;
}
function polylineMeasureFunction()
{
deactivateToolbarIcon(‘iconLineMeasure’);
deactivateToolbarIcon(‘iconZoomBox’);
if (iconAreaMeasureActive == false)
{
iconAreaMeasureActive = true;
Map1.setMeasureMode('PolygonMeasure');
document.getElementById('iconAreaMeasure').src = "../Content/images/iconAreaMeasure-hover.png";
document.getElementById('iconAreaMeasure').style.border = "inset";
}
else
{
deactivateToolbarIcon('iconAreaMeasure');
}
return false;
}
function deactivateToolbarIcon(iconID)
{
switch (iconID) {
case “iconLineMeasure”:
{
iconLineMeasureActive = false;
Map1.setMeasureMode(‘Normal’);
document.getElementById(‘iconLineMeasure’).src = “…/Content/images/iconLineMeasure.png”;
document.getElementById(‘iconLineMeasure’).style.border = “outset”;
}
break;
case “iconAreaMeasure”:
{
iconAreaMeasureActive = false;
Map1.setMeasureMode(‘Normal’);
document.getElementById(‘iconAreaMeasure’).src = “…/Content/images/iconAreaMeasure.png”;
document.getElementById(‘iconAreaMeasure’).style.border = “outset”;
}
break;
default:
break;
}
}