From 989d9480d175d84c2edc2a04aef8cf6ec26fd38d Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Wed, 25 May 2016 22:52:29 +0200 Subject: [PATCH] [TASK] Adjust marker style - focus on online nodes --- lib/map.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/map.js b/lib/map.js index 8230817..3c7c6bc 100644 --- a/lib/map.js +++ b/lib/map.js @@ -160,8 +160,8 @@ define(["map/clientlayer", "map/labelslayer", var iconOnline = {color: "#1566A9", fillColor: "#1566A9", radius: 6, fillOpacity: 0.5, opacity: 0.5, weight: 2, className: "stroke-first"}; var iconOffline = {color: "#D43E2A", fillColor: "#D43E2A", radius: 3, fillOpacity: 0.5, opacity: 0.5, weight: 1, className: "stroke-first"}; - var iconLost = {color: "#D43E2A", fillColor: "#D43E2A", radius: 6, fillOpacity: 0.8, opacity: 0.8, weight: 1, className: "stroke-first"}; - var iconAlert = {color: "#D43E2A", fillColor: "#D43E2A", radius: 6, fillOpacity: 0.8, opacity: 0.8, weight: 2, className: "stroke-first node-alert"}; + var iconLost = {color: "#D43E2A", fillColor: "#D43E2A", radius: 4, fillOpacity: 0.8, opacity: 0.8, weight: 1, className: "stroke-first"}; + var iconAlert = {color: "#D43E2A", fillColor: "#D43E2A", radius: 5, fillOpacity: 0.8, opacity: 0.8, weight: 2, className: "stroke-first"}; var iconNew = {color: "#1566A9", fillColor: "#93E929", radius: 6, fillOpacity: 1.0, opacity: 0.5, weight: 2}; return function (config, linkScale, sidebar, router, buttons) { @@ -299,14 +299,12 @@ define(["map/clientlayer", "map/labelslayer", }; }); - layers[0].layer.addTo(map); layers.forEach(function (d) { baseLayers[d.name] = d.layer; }); - map.on("locationfound", locationFound); map.on("locationerror", locationError); map.on("dragend", saveView); @@ -348,11 +346,13 @@ define(["map/clientlayer", "map/labelslayer", labelsLayer.addTo(map); labelsLayer.setZIndex(6); - map.on("baselayerchange", function(e) { + map.on("baselayerchange", function (e) { map.options.maxZoom = e.layer.options.maxZoom; clientLayer.options.maxZoom = map.options.maxZoom; labelsLayer.options.maxZoom = map.options.maxZoom; - if (map.getZoom() > map.options.maxZoom) map.setZoom(map.options.maxZoom); + if (map.getZoom() > map.options.maxZoom) { + map.setZoom(map.options.maxZoom); + } if (localStorageTest()) { localStorage.setItem("map/selectedLayer", JSON.stringify({name: e.name})); } @@ -411,7 +411,7 @@ define(["map/clientlayer", "map/labelslayer", m = linkDict[highlight.o.id]; if (m) { - m.setStyle({weight: 7, opacity: 1, dashArray: "10, 10"}); + m.setStyle({weight: 4, opacity: 1, dashArray: "5, 10"}); } } } @@ -528,12 +528,14 @@ define(["map/clientlayer", "map/labelslayer", return iconAlert; } - return iconLost; + if (d.lastseen.isAfter(moment(data.now).subtract(14, "days"))) { + return iconLost; + } }, router)); groupOffline = L.featureGroup(markersOffline).addTo(map); - groupOnline = L.featureGroup(markersOnline).addTo(map); groupLost = L.featureGroup(markersLost).addTo(map); + groupOnline = L.featureGroup(markersOnline).addTo(map); groupNew = L.featureGroup(markersNew).addTo(map); var rtreeOnlineAll = rbush(9);