diff --git a/README.md b/README.md index 334c9e6..fd99aae 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A [quadtree](https://en.wikipedia.org/wiki/Quadtree) recursively partitions two- ## Installing -If you use NPM, `npm install d3-quadtree`. Otherwise, download the [latest release](https://github.com/d3/d3-quadtree/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-quadtree.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: +If you use NPM, `npm install d3-quadtree`. Otherwise, download the [latest release](https://github.com/d3/d3-quadtree/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-quadtree.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: ```html diff --git a/package.json b/package.json index 3fd9691..f1616f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "d3-quadtree", - "version": "1.0.7", + "version": "2.0.0-rc.1", + "publishConfig": { + "tag": "next" + }, "description": "Two-dimensional recursive spatial subdivision.", "keywords": [ "d3", diff --git a/src/add.js b/src/add.js index ac7c4d1..985adfc 100644 --- a/src/add.js +++ b/src/add.js @@ -1,5 +1,5 @@ export default function(d) { - var x = +this._x.call(null, d), + const x = +this._x.call(null, d), y = +this._y.call(null, d); return add(this.cover(x, y), x, y, d); } diff --git a/src/cover.js b/src/cover.js index a981a3d..e1d47cd 100644 --- a/src/cover.js +++ b/src/cover.js @@ -16,7 +16,7 @@ export default function(x, y) { // Otherwise, double repeatedly to cover. else { - var z = x1 - x0, + var z = x1 - x0 || 1, node = this._root, parent, i; diff --git a/test/cover-test.js b/test/cover-test.js index cd49d09..08c42a0 100644 --- a/test/cover-test.js +++ b/test/cover-test.js @@ -77,3 +77,8 @@ tape("quadtree.cover(x, y) does not wrap the root node if it is undefined", func test.equal(q.copy().cover(-3, -3).root(), undefined); test.end(); }); + +tape("quadtree.cover() does not crash on huge values", function(test) { + d3_quadtree.quadtree([[1e23, 0]]); + test.end(); +});