Open jestelle opened 2 years ago
If draw-tools is installed, something goes wrong in layer-count and it doesn't work.
I fixed it by basically disabling the chunk of code that interacts with draw tools.
Here's my local fix:
` plugin.layerCount.onBtnClick = function(ev) { var btn = plugin.layerCount.button, tooltip = plugin.layerCount.tooltip, layer = plugin.layerCount.layer;
var drawToolsEnabled = false; if(btn.classList.contains("active")) { if(window.plugin.drawTools !== undefined && drawToolsEnabled) { window.plugin.drawTools.drawnItems.eachLayer(function(layer) { if (layer instanceof L.GeodesicPolygon) { L.DomUtil.addClass(layer._path, "leaflet-clickable"); layer._path.setAttribute("pointer-events", layer.options.pointerEventsBackup); layer.options.pointerEvents = layer.options.pointerEventsBackup; layer.options.clickable = true; } }); } map.off("click", plugin.layerCount.calculate); btn.classList.remove("active"); } else { console.log("inactive"); if(window.plugin.drawTools !== undefined && drawToolsEnabled) { window.plugin.drawTools.drawnItems.eachLayer(function(layer) { if (layer instanceof L.GeodesicPolygon) { layer.options.pointerEventsBackup = layer.options.pointerEvents; layer.options.pointerEvents = null; layer.options.clickable = false; L.DomUtil.removeClass(layer._path, "leaflet-clickable"); layer._path.setAttribute("pointer-events", "none"); } }); } map.on("click", plugin.layerCount.calculate); btn.classList.add("active"); setTimeout(function(){ tooltip.textContent = "Click on map"; }, 10); }
}; `
https://github.com/IITC-CE/ingress-intel-total-conversion
If draw-tools is installed, something goes wrong in layer-count and it doesn't work.
I fixed it by basically disabling the chunk of code that interacts with draw tools.
Here's my local fix:
` plugin.layerCount.onBtnClick = function(ev) { var btn = plugin.layerCount.button, tooltip = plugin.layerCount.tooltip, layer = plugin.layerCount.layer;
}; `