[TASK] Update to rbush 2.0

This commit is contained in:
Xaver Maierhofer 2017-02-06 01:50:08 +01:00 committed by Xaver Maierhofer
parent 92272d87ad
commit 958f710443
5 changed files with 16 additions and 13 deletions

View File

@ -396,8 +396,8 @@ define(['map/clientlayer', 'map/labelslayer',
}
function mapRTree(d) {
var o = [d.nodeinfo.location.latitude, d.nodeinfo.location.longitude,
d.nodeinfo.location.latitude, d.nodeinfo.location.longitude];
var o = { minX: d.nodeinfo.location.latitude, minY: d.nodeinfo.location.longitude,
maxX: d.nodeinfo.location.latitude, maxY: d.nodeinfo.location.longitude };
o.node = d;

View File

@ -22,7 +22,7 @@ define(['leaflet', 'rbush', 'helper'],
}
function mapRTree(d) {
var o = [d.position.lat, d.position.lng, d.position.lat, d.position.lng];
var o = { minX: d.position.lat, minY: d.position.lng, maxX: d.position.lat, maxY: d.position.lng };
o.label = d;
@ -72,7 +72,7 @@ define(['leaflet', 'rbush', 'helper'],
var x = p.x + offset[0] + dx[anchor[0]];
var y = p.y + offset[1] + dy[anchor[1]];
return [x, y, x + width, y + height];
return { minX: x, minY: y, maxX: x + width, maxY: y + height };
}
return L.TileLayer.Canvas.extend({
@ -124,8 +124,7 @@ define(['leaflet', 'rbush', 'helper'],
function nodeToRect(z) {
return function (n) {
var p = map.project(n.position, z);
return [p.x - nodeRadius, p.y - nodeRadius,
p.x + nodeRadius, p.y + nodeRadius];
return { minX: p.x - nodeRadius, minY: p.y - nodeRadius, maxX: p.x + nodeRadius, maxY: p.y + nodeRadius };
};
}
@ -206,9 +205,7 @@ define(['leaflet', 'rbush', 'helper'],
}
var bbox = helper.getTileBBox(s, map, tileSize, this.margin);
var labels = this.labels.search(bbox).map(projectNodes);
var ctx = canvas.getContext('2d');
ctx.lineWidth = 5;

View File

@ -194,6 +194,6 @@ define({
var tl = map.unproject([s.x - margin, s.y - margin]);
var br = map.unproject([s.x + margin + tileSize, s.y + margin + tileSize]);
return [br.lat, tl.lng, tl.lat, br.lng];
return { minX: br.lat, minY: tl.lng, maxX: tl.lat, maxY: br.lng };
}
});

View File

@ -50,7 +50,7 @@
"moment": "^2.17.1",
"node-polyglot": "^2.2.2",
"promise-polyfill": "^6.0.2",
"rbush": "1.4.3",
"rbush": "^2.0.1",
"requirejs": "^2.3.2",
"virtual-dom": "^2.1.1"
}

View File

@ -2810,6 +2810,10 @@ qs@~5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-5.1.0.tgz#4d932e5c7ea411cca76a312d39a606200fd50cd9"
quickselect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-1.0.0.tgz#02630818f9aae4ecab26f0103f98d061c17c58f3"
randomatic@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb"
@ -2829,9 +2833,11 @@ raw-body@~2.1.5:
iconv-lite "0.4.13"
unpipe "1.0.0"
rbush@1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/rbush/-/rbush-1.4.3.tgz#7874e2d38911d2719ea27731d32445da5ec4394c"
rbush@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/rbush/-/rbush-2.0.1.tgz#4cfaca28c3064bc0ee75431a1b79990e875eefa9"
dependencies:
quickselect "^1.0.0"
rc@~1.1.6:
version "1.1.6"