fix tree bug where removes would fail

the width or height of the rtree rectangle created by extentRectangle
would be negative. These rectangles insert ok, and are found by search,
but they cannot be removed.

issue #1370
This commit is contained in:
Ansis Brammanis
2013-04-24 19:27:43 -04:00
parent 53a9c23835
commit a0e8292067

View File

@@ -10,9 +10,9 @@ iD.Tree = function(graph) {
function extentRectangle(extent) {
x = m * extent[0][0],
y = m * extent[0][1],
dx = m * extent[1][0] - x || 2,
dy = m * extent[1][1] - y || 2;
return new RTree.Rectangle(~~x, ~~y, ~~dx - 1, ~~dy - 1);
dx = Math.max(m * extent[1][0] - x, 1),
dy = Math.max(m * extent[1][1] - y, 1);
return new RTree.Rectangle(~~x, ~~y, ~~dx, ~~dy);
}
function insert(entity) {