handle multiple setData calls in map
This commit is contained in:
parent
0a0b8bd065
commit
0490455ccf
18
lib/map.js
18
lib/map.js
@ -57,6 +57,7 @@ define(["d3", "leaflet", "moment", "leaflet.label"], function (d3, L, moment) {
|
||||
return function (config, linkScale, sidebar, router) {
|
||||
var self = this
|
||||
var barycenter
|
||||
var groupOnline, groupOffline, groupNew, groupLost, groupLines
|
||||
|
||||
var el = document.createElement("div")
|
||||
el.classList.add("map")
|
||||
@ -94,8 +95,23 @@ define(["d3", "leaflet", "moment", "leaflet.label"], function (d3, L, moment) {
|
||||
nodeDict = {}
|
||||
linkDict = {}
|
||||
|
||||
if (groupOffline)
|
||||
groupOffline.clearLayers()
|
||||
|
||||
if (groupOnline)
|
||||
groupOnline.clearLayers()
|
||||
|
||||
if (groupNew)
|
||||
groupNew.clearLayers()
|
||||
|
||||
if (groupLost)
|
||||
groupLost.clearLayers()
|
||||
|
||||
if (groupLines)
|
||||
groupLines.clearLayers()
|
||||
|
||||
var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router)
|
||||
L.featureGroup(lines).addTo(map)
|
||||
groupLines = L.featureGroup(lines).addTo(map)
|
||||
|
||||
barycenter = calcBarycenter(data.nodes.all.filter(has_location))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user