How to remove 'New measurement' button after taking measurements?

357
1
08-23-2021 12:38 PM
socialpromotions
New Contributor II

Hi, I'm using the Measurement widget in 2D and I would like this 'New measurement' button to go away after I have done my measurements in the widget. I do not a delete button in the widget and I have to close ( make it go from a '+' symbol to pointer) it by hitting the esc button on my keyboard or clicking on the measure widget again.

I was hoping .destroy() at the last would do this but it doesn't .

view.ui.add(activeWidget"top-right");
          setActiveButton(document.getElementById("areaButton"));
          break;
        case null:
          if (activeWidget) {
            view.ui.remove(activeWidget);
            activeWidget.destroy();
            activeWidget = null;
          }
          break;
          
      }
    }

Can I add a button to go out of the widget and also close this blue tab with it?

Thanks

0 Kudos
1 Reply
BenRomlein
Occasional Contributor

You can use css to hide the button in the interface:

 

 

.esri-distance-measurement-2d__clear-button {
    display: none;
}

 

 

If you want a button to clear measurements and reset the widget, you can create a button in your interface and use some JS like:

 

clearButton.addEventListener("click", function () {
    measurement.clear();
});

 

where measurement is the name of your Measurement object.
0 Kudos