Skip to content

Commit 070b463

Browse files
committed
Reuse infinite extent.
1 parent 92b010f commit 070b463

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

d3.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4321,9 +4321,7 @@ function d3_behavior_dragClick() {
43214321
d3.behavior.zoom = function() {
43224322
var xyz = [0, 0, 0],
43234323
event = d3.dispatch("zoom"),
4324-
extent = [[-Infinity, Infinity],
4325-
[-Infinity, Infinity],
4326-
[-Infinity, Infinity]];
4324+
extent = d3_behavior_zoomInfiniteExtent;
43274325

43284326
function zoom() {
43294327
this
@@ -4386,7 +4384,7 @@ d3.behavior.zoom = function() {
43864384

43874385
zoom.extent = function(x) {
43884386
if (!arguments.length) return extent;
4389-
extent = x == null ? (x = [-Infinity, Infinity], [x, x, x]) : x;
4387+
extent = x == null ? d3_behavior_zoomInfiniteExtent : x;
43904388
return zoom;
43914389
};
43924390

@@ -4550,6 +4548,12 @@ function d3_behavior_zoomTo(z, x0, x1) {
45504548
o.preventDefault();
45514549
}
45524550

4551+
var d3_behavior_zoomInfiniteExtent = [
4552+
[-Infinity, Infinity],
4553+
[-Infinity, Infinity],
4554+
[-Infinity, Infinity]
4555+
];
4556+
45534557
function d3_behavior_zoomExtentClamp(x, i, k) {
45544558
var range = d3_behavior_zoomExtent[i],
45554559
r0 = range[0],

0 commit comments

Comments
 (0)