var button = document.createElement("input");
button.setAttribute("type", "button");
button.value = "Monitor";
- button.onclick = monitorCanvass.bind(null, turfs[i].canvasses[j]);
+ button.onclick = monitorCanvass.bind(null, turfs[i].canvasses[j], turfs[i]);
cell.appendChild(button);
}
row.appendChild(cell);
document.getElementById("cacheBug").removeClass("expanded");
}
-function monitorCanvass(canvass) {
+function monitorCanvass(canvass, turf) {
console.log(canvass);
// fetch("api.php?get=canvassMonitor&id="+canvass).then(data => data.json())
// .then(output => {
// Pop-up on updates
debug("monitorCanvass(..., ...)");
debug(canvass);
-// debug(turf);
+ debug(turf);
setLoading(1);
map.on("moveend", loadCanvassers.bind(null, false, canvass));
// loadTurfs();
-/* var json = turf.json;
- var turfPoints = JSON.parse(json).geometry.coordinates[0];
- var latTot = 0;
- var lonTot = 0;
- var i = 0;
- for(i = 0; i < turfPoints.length; i++) {
- latTot += turfPoints[i][1];
- lonTot += turfPoints[i][0];
- }
-*/
+ var json = turf.json;
+ var turfPoints = JSON.parse(json).geometry.coordinates[0];
+ var latTot = 0;
+ var lonTot = 0;
+ var i = 0;
+ for(i = 0; i < turfPoints.length; i++) {
+ latTot += turfPoints[i][1];
+ lonTot += turfPoints[i][0];
+ }
+
map.setZoom(19);
map.setView([latTot/i, lonTot/i]);
enableCanvassControls();
currentCanvass = canvass;
-// turfLayer = turf;
-// setTimeout(toggleTurf.bind(null, turf, true), 1000);
+ turfLayer = turf;
+ setTimeout(toggleTurf.bind(null, turf, true), 1000);
viewCanvass(canvass);
/* var options = {