I have a simple Leaflet map to which I've added two functionalities:
measure tool using leaflet.measure plugin;
WMS getFeatureInfo popup using the L.TileLayer.BetterWMS plugin;
The default map behaviour in this context shows both popups - measure popup and info popup.
Screenshot:
I have added the code to jsFiddle.
So my question is:
How can I prevent the info popup from showing up while using the measure tool?
Edit
I managed to disable the popup by using
$( ".leaflet-control-measure" ).click(function() {
map.off('click', layer.getFeatureInfo, layer);
});
but now I need to turn them back on. I tried using jQuery toggle(), but something weird happens to the measure button.
$(".leaflet-control-measure").toggle(function() {
map.off('click', layer.getFeatureInfo, layer);
} , function() {
map.on('click', layer.getFeatureInfo, layer);
});

Leaflet.TileLayer.BetterWMSis not a well-known Leaflet plugin. Where did you get it? The solution will depend on its implementation of the popups.L.TileLayer.BetterWMSplugin in my question. I got it from GitHub.