Skip to content

Commit 3fb2608

Browse files
committed
quadtree.find takes ([x, y]), not (x, y).
This makes it easier to use with d3.mouse.
1 parent 1d4c3f3 commit 3fb2608

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

d3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5559,8 +5559,8 @@
55595559
root.visit = function(f) {
55605560
d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);
55615561
};
5562-
root.find = function(x, y) {
5563-
return d3_geom_quadtreeFind(root, x, y, x1_, y1_, x2_, y2_);
5562+
root.find = function(point) {
5563+
return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_);
55645564
};
55655565
i = -1;
55665566
if (x1 == null) {

d3.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geom/quadtree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ d3.geom.quadtree = function(points, x1, y1, x2, y2) {
129129
// TODO allow the initial search extent to be specified?
130130
// TODO allow the initial minimum distance to be specified?
131131
// TODO allow searching below any node?
132-
root.find = function(x, y) {
133-
return d3_geom_quadtreeFind(root, x, y, x1_, y1_, x2_, y2_);
132+
root.find = function(point) {
133+
return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_);
134134
};
135135

136136
// Insert all points.

test/geom/quadtree-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ suite.addBatch({
4343
var dx = 17, dy = 17,
4444
points = _.range(dx * dy).map(function(i) { return [i % dx, i / dx | 0]; });
4545
q = q(points);
46-
assert.deepEqual(q.find(.1, .1), [0, 0]);
47-
assert.deepEqual(q.find(7.5, 7.5), [7, 7]);
48-
assert.deepEqual(q.find(.1, 15.9), [0, 16]);
49-
assert.deepEqual(q.find(15.9, 15.9), [16, 16]);
46+
assert.deepEqual(q.find([.1, .1]), [0, 0]);
47+
assert.deepEqual(q.find([7.5, 7.5]), [7, 7]);
48+
assert.deepEqual(q.find([.1, 15.9]), [0, 16]);
49+
assert.deepEqual(q.find([15.9, 15.9]), [16, 16]);
5050
}
5151
},
5252
"the quadtree applied directly": {

0 commit comments

Comments
 (0)