Skip to content

Commit

Permalink
Merge pull request #34 from d3/two
Browse files Browse the repository at this point in the history
Two
  • Loading branch information
Fil authored Aug 23, 2020
2 parents eea2ae6 + 5f83d1f commit a54fb1d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<script src="https://d3js.org/d3-quadtree.v1.min.js"></script>
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/add.js
Original file line number Diff line number Diff line change
@@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions test/cover-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

0 comments on commit a54fb1d

Please sign in to comment.