aboutsummaryrefslogtreecommitdiff
path: root/web/public/javascripts/map.js
diff options
context:
space:
mode:
authorSamarth-Agarwal1 <agarwalsamarth@hotmail.com>2019-03-26 21:13:18 +0000
committerGitHub <noreply@github.com>2019-03-26 21:13:18 +0000
commitdab5626549cffd2be33ab41928a14fa631fffd2b (patch)
tree4f181114e3a1b9fcf6442b9a96424f31aabd437c /web/public/javascripts/map.js
parentc0723a3b208c560e183aa78464699d6d8e4ce8ef (diff)
parent933d8276bde1617e3d7cc4aec53c9ba7112ef11b (diff)
Merge pull request #45 from csc301-winter-2019/feat/30
Feat/30
Diffstat (limited to 'web/public/javascripts/map.js')
-rw-r--r--web/public/javascripts/map.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/web/public/javascripts/map.js b/web/public/javascripts/map.js
index 8d4fc3b..544da9e 100644
--- a/web/public/javascripts/map.js
+++ b/web/public/javascripts/map.js
@@ -2,6 +2,7 @@
// L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
// attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
// }).addTo(map);
+let currPoint;
const Races = {
"White" : "European or White",
@@ -31,7 +32,8 @@ function plotPointsOnMap(points) {
function showDetails(e) {
// layer.feature.geometry gives you access to all the fields
let layer = e.layer;
-
+ currPoint = layer;
+
let sideBar = document.getElementById('sidebar');
if (getComputedStyle(sideBar).visibility === 'hidden') {
@@ -80,13 +82,27 @@ function showDetails(e) {
let extraText = document.createTextNode(layer.feature.geometry['extra']);
extraTextSpan.appendChild(extraText);
- let closeBtn = document.getElementById('close-btn')
- closeBtn.addEventListener('click', closeDetails)
+ let pendingBtn = document.getElementById('pending-btn');
+ pendingBtn.addEventListener('click', markAsPending);
+
+ let completedBtn = document.getElementById('completed-btn');
+ completedBtn.addEventListener('click', markAsCompleted);
+
+ let closeBtn = document.getElementById('close-btn');
+ closeBtn.addEventListener('click', closeDetails);
+}
+
+function markAsPending(e) {
+ currPoint._icon.src = '../assets/orange-icon.png';
+}
+
+function markAsCompleted(e) {
+ map.removeLayer(currPoint);
}
function closeDetails(e) {
let details = document.getElementById('sidebar')
- details.style.visibility = 'hidden'
+ details.style.visibility = 'hidden';
}
// different basemap