map: work with no or little nodes

This commit is contained in:
Nils Schneider 2015-07-07 21:28:44 +02:00
parent e67c61d7d3
commit 02a03e5a61
2 changed files with 12 additions and 3 deletions

View file

@ -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))