From 9a242e9e6e4c10da49fb810362743bc3e47518db Mon Sep 17 00:00:00 2001 From: Brian Flowers Date: Fri, 7 Feb 2025 00:24:03 -0500 Subject: [PATCH] Adding markers for monitoring --- js/canvassing.js | 29 ++++++++++++++++++++++++++++- js/common.js | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/js/canvassing.js b/js/canvassing.js index f0f01ea..ddae5a1 100644 --- a/js/canvassing.js +++ b/js/canvassing.js @@ -1052,7 +1052,34 @@ function loadCanvassers(force = false, canvass) { .then(resp => { console.log(resp); for(var i = 0; i < resp.length; i++) { - console.log(resp[i]); + iconImg = "marker-icon-"+iconColors[i]+".png"; + + var markerIcon = L.icon({ + iconUrl: "images/"+iconImg, + iconSize: [48, 72], + iconAnchor: [24,72], + className: 'leaflet-marker' + }); + var markerTitle = "UserID: "+resp[i].userId; + var newMarker = new L.marker([resp[i].latitude, resp[i].longitude], + {icon: markerIcon, title: markerTitle}).addTo(map); +/* if( locList[i].count > 1) { + newMarker.bindTooltip(locList[i].count+"", + { + permanent: true, + direction: 'right', + className: 'leaflet-voterCount' + } + ); + }*/ + /*var markerText = new L.Marker([locList[i].latitude, locList[i].longitude], { + icon: new L.DivIcon({ + className: 'my-div-icon', + html: '---'+locList[i].count+'-------' + }) +});*/ + newMarker.on('click', voterList.bind(null, locList[i].latitude, locList[i].longitude)); + } debug("End loadCanvassers"); }); diff --git a/js/common.js b/js/common.js index 9958099..3027fce 100644 --- a/js/common.js +++ b/js/common.js @@ -68,7 +68,7 @@ TODO: Comment code more, especially: * If not, see . */ -var _CCCP_DEBUG = false; +var _CCCP_DEBUG = true; function debug(msg) { if(_CCCP_DEBUG) { // debugger; @@ -108,6 +108,7 @@ var displayAreas = []; var colors = ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#00FFFF", "#FF00FF", "#880000", "#008800", "#000088", "#888800", "#008888", "#880088"] +var iconColors = ["red", "blue", "purple", "rose"] // INITIALIZATION /////////////////////////////////////////////////////////// -- 1.8.3.1