map: work with no or little nodes
This commit is contained in:
parent
e67c61d7d3
commit
02a03e5a61
@ -327,6 +327,12 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
var barycenter = L.latLng(d3.median(lats), d3.median(lngs))
|
||||
var barycenterDev = [d3.deviation(lats), d3.deviation(lngs)]
|
||||
|
||||
if (barycenterDev[0] === undefined)
|
||||
barycenterDev[0] = 0
|
||||
|
||||
if (barycenterDev[1] === undefined)
|
||||
barycenterDev[1] = 0
|
||||
|
||||
var barycenterCircle = L.latLng(barycenter.lat + barycenterDev[0],
|
||||
barycenter.lng + barycenterDev[1])
|
||||
|
||||
|
@ -155,9 +155,12 @@ define(["leaflet", "rbush"],
|
||||
return undefined
|
||||
}).filter(function (d) { return d !== undefined })
|
||||
|
||||
this.margin = 16 + labels.map(function (d) {
|
||||
return d.width
|
||||
}).sort().reverse()[0]
|
||||
this.margin = 16
|
||||
|
||||
if (labels.length > 0)
|
||||
this.margin += labels.map(function (d) {
|
||||
return d.width
|
||||
}).sort().reverse()[0]
|
||||
|
||||
this.labels = rbush(9)
|
||||
this.labels.load(labels.map(mapRTree))
|
||||
|
Loading…
Reference in New Issue
Block a user