Skip to content

Commit 87acef2

Browse files
committed
Merge branch '3.3.9'
2 parents ed54503 + d44de8f commit 87acef2

15 files changed

Lines changed: 188 additions & 84 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "d3",
3-
"version": "3.3.8",
3+
"version": "3.3.9",
44
"main": "d3.js",
55
"scripts": [
66
"d3.js"

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"animation",
1111
"canvas"
1212
],
13-
"version": "3.3.8",
13+
"version": "3.3.9",
1414
"main": "index-browserify.js",
1515
"scripts": [
1616
"d3.js",

d3.js

Lines changed: 90 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
d3 = function() {
22
var d3 = {
3-
version: "3.3.8"
3+
version: "3.3.9"
44
};
55
if (!Date.now) Date.now = function() {
66
return +new Date();
@@ -1059,13 +1059,16 @@ d3 = function() {
10591059
}
10601060
};
10611061
}
1062-
var d3_event_dragSelect = d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_dragId = 0;
1062+
var d3_event_dragSelect = "onselectstart" in d3_document ? null : d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_dragId = 0;
10631063
function d3_event_dragSuppress() {
1064-
var name = ".dragsuppress-" + ++d3_event_dragId, touchmove = "touchmove" + name, selectstart = "selectstart" + name, dragstart = "dragstart" + name, click = "click" + name, w = d3.select(d3_window).on(touchmove, d3_eventPreventDefault).on(selectstart, d3_eventPreventDefault).on(dragstart, d3_eventPreventDefault), style = d3_documentElement.style, select = style[d3_event_dragSelect];
1065-
style[d3_event_dragSelect] = "none";
1064+
var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault);
1065+
if (d3_event_dragSelect) {
1066+
var style = d3_documentElement.style, select = style[d3_event_dragSelect];
1067+
style[d3_event_dragSelect] = "none";
1068+
}
10661069
return function(suppressClick) {
10671070
w.on(name, null);
1068-
style[d3_event_dragSelect] = select;
1071+
if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
10691072
if (suppressClick) {
10701073
function off() {
10711074
w.on(click, null);
@@ -3511,6 +3514,15 @@ d3 = function() {
35113514
function d3_geo_resample(project) {
35123515
var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16;
35133516
function resample(stream) {
3517+
return (maxDepth ? resampleRecursive : resampleNone)(stream);
3518+
}
3519+
function resampleNone(stream) {
3520+
return d3_geo_transformPoint(stream, function(x, y) {
3521+
x = project(x, y);
3522+
stream.point(x[0], x[1]);
3523+
});
3524+
}
3525+
function resampleRecursive(stream) {
35143526
var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;
35153527
var resample = {
35163528
point: point,
@@ -3577,38 +3589,6 @@ d3 = function() {
35773589
};
35783590
return resample;
35793591
}
3580-
d3.geo.transform = function(methods) {
3581-
return {
3582-
stream: function(stream) {
3583-
var transform = new d3_geo_transform(stream);
3584-
for (var k in methods) transform[k] = methods[k];
3585-
return transform;
3586-
}
3587-
};
3588-
};
3589-
function d3_geo_transform(stream) {
3590-
this.stream = stream;
3591-
}
3592-
d3_geo_transform.prototype = {
3593-
point: function(x, y) {
3594-
this.stream.point(x, y);
3595-
},
3596-
sphere: function() {
3597-
this.stream.sphere();
3598-
},
3599-
lineStart: function() {
3600-
this.stream.lineStart();
3601-
},
3602-
lineEnd: function() {
3603-
this.stream.lineEnd();
3604-
},
3605-
polygonStart: function() {
3606-
this.stream.polygonStart();
3607-
},
3608-
polygonEnd: function() {
3609-
this.stream.polygonEnd();
3610-
}
3611-
};
36123592
d3.geo.path = function() {
36133593
var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream;
36143594
function path(object) {
@@ -3661,11 +3641,59 @@ d3 = function() {
36613641
return project([ x * d3_degrees, y * d3_degrees ]);
36623642
});
36633643
return function(stream) {
3664-
var transform = new d3_geo_transform(stream = resample(stream));
3665-
transform.point = function(x, y) {
3666-
stream.point(x * d3_radians, y * d3_radians);
3667-
};
3668-
return transform;
3644+
return d3_geo_projectionRadians(resample(stream));
3645+
};
3646+
}
3647+
d3.geo.transform = function(methods) {
3648+
return {
3649+
stream: function(stream) {
3650+
var transform = new d3_geo_transform(stream);
3651+
for (var k in methods) transform[k] = methods[k];
3652+
return transform;
3653+
}
3654+
};
3655+
};
3656+
function d3_geo_transform(stream) {
3657+
this.stream = stream;
3658+
}
3659+
d3_geo_transform.prototype = {
3660+
point: function(x, y) {
3661+
this.stream.point(x, y);
3662+
},
3663+
sphere: function() {
3664+
this.stream.sphere();
3665+
},
3666+
lineStart: function() {
3667+
this.stream.lineStart();
3668+
},
3669+
lineEnd: function() {
3670+
this.stream.lineEnd();
3671+
},
3672+
polygonStart: function() {
3673+
this.stream.polygonStart();
3674+
},
3675+
polygonEnd: function() {
3676+
this.stream.polygonEnd();
3677+
}
3678+
};
3679+
function d3_geo_transformPoint(stream, point) {
3680+
return {
3681+
point: point,
3682+
sphere: function() {
3683+
stream.sphere();
3684+
},
3685+
lineStart: function() {
3686+
stream.lineStart();
3687+
},
3688+
lineEnd: function() {
3689+
stream.lineEnd();
3690+
},
3691+
polygonStart: function() {
3692+
stream.polygonStart();
3693+
},
3694+
polygonEnd: function() {
3695+
stream.polygonEnd();
3696+
}
36693697
};
36703698
}
36713699
d3.geo.projection = d3_geo_projection;
@@ -3748,11 +3776,9 @@ d3 = function() {
37483776
};
37493777
}
37503778
function d3_geo_projectionRadians(stream) {
3751-
var transform = new d3_geo_transform(stream);
3752-
transform.point = function(λ, φ) {
3753-
stream.point(λ * d3_radians, φ * d3_radians);
3754-
};
3755-
return transform;
3779+
return d3_geo_transformPoint(stream, function(x, y) {
3780+
stream.point(x * d3_radians, y * d3_radians);
3781+
});
37563782
}
37573783
function d3_geo_equirectangular(λ, φ) {
37583784
return [ λ, φ ];
@@ -6955,10 +6981,24 @@ d3 = function() {
69556981
return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
69566982
}
69576983
function d3_scale_linearTickFormat(domain, m, format) {
6958-
var precision = -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01);
6984+
var range = d3_scale_linearTickRange(domain, m);
69596985
return d3.format(format ? format.replace(d3_format_re, function(a, b, c, d, e, f, g, h, i, j) {
6960-
return [ b, c, d, e, f, g, h, i || "." + (precision - (j === "%") * 2), j ].join("");
6961-
}) : ",." + precision + "f");
6986+
return [ b, c, d, e, f, g, h, i || "." + d3_scale_linearFormatPrecision(j, range), j ].join("");
6987+
}) : ",." + d3_scale_linearPrecision(range[2]) + "f");
6988+
}
6989+
var d3_scale_linearFormatSignificant = {
6990+
s: 1,
6991+
g: 1,
6992+
p: 1,
6993+
r: 1,
6994+
e: 1
6995+
};
6996+
function d3_scale_linearPrecision(value) {
6997+
return -Math.floor(Math.log(value) / Math.LN10 + .01);
6998+
}
6999+
function d3_scale_linearFormatPrecision(type, range) {
7000+
var p = d3_scale_linearPrecision(range[2]);
7001+
return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(Math.abs(range[0]), Math.abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2;
69627002
}
69637003
d3.scale.log = function() {
69647004
return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]);

d3.min.js

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "d3",
3-
"version": "3.3.8",
3+
"version": "3.3.9",
44
"description": "A small, free JavaScript library for manipulating documents based on data.",
55
"keywords": [
66
"dom",

src/event/drag.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@ import "../core/document";
22
import "../core/vendor";
33
import "../selection/on";
44

5-
var d3_event_dragSelect = d3_vendorSymbol(d3_documentElement.style, "userSelect"),
5+
var d3_event_dragSelect = "onselectstart" in d3_document ? null : d3_vendorSymbol(d3_documentElement.style, "userSelect"),
66
d3_event_dragId = 0;
77

88
function d3_event_dragSuppress() {
99
var name = ".dragsuppress-" + ++d3_event_dragId,
10-
touchmove = "touchmove" + name,
11-
selectstart = "selectstart" + name,
12-
dragstart = "dragstart" + name,
1310
click = "click" + name,
14-
w = d3.select(d3_window).on(touchmove, d3_eventPreventDefault).on(selectstart, d3_eventPreventDefault).on(dragstart, d3_eventPreventDefault),
15-
style = d3_documentElement.style,
16-
select = style[d3_event_dragSelect];
17-
style[d3_event_dragSelect] = "none";
11+
w = d3.select(d3_window)
12+
.on("touchmove" + name, d3_eventPreventDefault)
13+
.on("dragstart" + name, d3_eventPreventDefault)
14+
.on("selectstart" + name, d3_eventPreventDefault);
15+
if (d3_event_dragSelect) {
16+
var style = d3_documentElement.style,
17+
select = style[d3_event_dragSelect];
18+
style[d3_event_dragSelect] = "none";
19+
}
1820
return function(suppressClick) {
1921
w.on(name, null);
20-
style[d3_event_dragSelect] = select;
22+
if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
2123
if (suppressClick) { // suppress the next click, but only if it’s immediate
2224
function off() { w.on(click, null); }
2325
w.on(click, function() { d3_eventPreventDefault(); off(); }, true);

src/geo/path.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import "path-context";
1313
import "projection";
1414
import "resample";
1515
import "stream";
16-
import "transform";
1716

1817
d3.geo.path = function() {
1918
var pointRadius = 4.5,
@@ -84,9 +83,5 @@ d3.geo.path = function() {
8483

8584
function d3_geo_pathProjectStream(project) {
8685
var resample = d3_geo_resample(function(x, y) { return project([x * d3_degrees, y * d3_degrees]); });
87-
return function(stream) {
88-
var transform = new d3_geo_transform(stream = resample(stream));
89-
transform.point = function(x, y) { stream.point(x * d3_radians, y * d3_radians); };
90-
return transform;
91-
};
86+
return function(stream) { return d3_geo_projectionRadians(resample(stream)); };
9287
}

src/geo/projection.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import "geo";
99
import "path";
1010
import "resample";
1111
import "rotation";
12-
import "stream";
1312
import "transform";
1413

1514
d3.geo.projection = d3_geo_projection;
@@ -116,9 +115,7 @@ function d3_geo_projectionMutator(projectAt) {
116115
}
117116

118117
function d3_geo_projectionRadians(stream) {
119-
var transform = new d3_geo_transform(stream);
120-
transform.point = function(λ, φ) {
121-
stream.point(λ * d3_radians, φ * d3_radians);
122-
};
123-
return transform;
118+
return d3_geo_transformPoint(stream, function(x, y) {
119+
stream.point(x * d3_radians, y * d3_radians);
120+
});
124121
}

src/geo/resample.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import "../math/abs";
22
import "../math/trigonometry";
33
import "cartesian";
4-
import "stream";
54

65
function d3_geo_resample(project) {
76
var δ2 = .5, // precision, px²
87
cosMinDistance = Math.cos(30 * d3_radians), // cos(minimum angular distance)
98
maxDepth = 16;
109

1110
function resample(stream) {
11+
return (maxDepth ? resampleRecursive : resampleNone)(stream);
12+
}
13+
14+
function resampleNone(stream) {
15+
return d3_geo_transformPoint(stream, function(x, y) {
16+
x = project(x, y);
17+
stream.point(x[0], x[1]);
18+
});
19+
}
20+
21+
function resampleRecursive(stream) {
1222
var λ00, φ00, x00, y00, a00, b00, c00, // first point
1323
λ0, x0, y0, a0, b0, c0; // previous point
1424

src/geo/transform.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,14 @@ d3_geo_transform.prototype = {
2323
polygonStart: function() { this.stream.polygonStart(); },
2424
polygonEnd: function() { this.stream.polygonEnd(); }
2525
};
26+
27+
function d3_geo_transformPoint(stream, point) {
28+
return {
29+
point: point,
30+
sphere: function() { stream.sphere(); },
31+
lineStart: function() { stream.lineStart(); },
32+
lineEnd: function() { stream.lineEnd(); },
33+
polygonStart: function() { stream.polygonStart(); },
34+
polygonEnd: function() { stream.polygonEnd(); },
35+
};
36+
}

0 commit comments

Comments
 (0)