|
1 | 1 | d3 = function() { |
2 | 2 | var d3 = { |
3 | | - version: "3.3.8" |
| 3 | + version: "3.3.9" |
4 | 4 | }; |
5 | 5 | if (!Date.now) Date.now = function() { |
6 | 6 | return +new Date(); |
@@ -1059,13 +1059,16 @@ d3 = function() { |
1059 | 1059 | } |
1060 | 1060 | }; |
1061 | 1061 | } |
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; |
1063 | 1063 | 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 | + } |
1066 | 1069 | return function(suppressClick) { |
1067 | 1070 | w.on(name, null); |
1068 | | - style[d3_event_dragSelect] = select; |
| 1071 | + if (d3_event_dragSelect) style[d3_event_dragSelect] = select; |
1069 | 1072 | if (suppressClick) { |
1070 | 1073 | function off() { |
1071 | 1074 | w.on(click, null); |
@@ -3511,6 +3514,15 @@ d3 = function() { |
3511 | 3514 | function d3_geo_resample(project) { |
3512 | 3515 | var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; |
3513 | 3516 | 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) { |
3514 | 3526 | var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; |
3515 | 3527 | var resample = { |
3516 | 3528 | point: point, |
@@ -3577,38 +3589,6 @@ d3 = function() { |
3577 | 3589 | }; |
3578 | 3590 | return resample; |
3579 | 3591 | } |
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 | | - }; |
3612 | 3592 | d3.geo.path = function() { |
3613 | 3593 | var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; |
3614 | 3594 | function path(object) { |
@@ -3661,11 +3641,59 @@ d3 = function() { |
3661 | 3641 | return project([ x * d3_degrees, y * d3_degrees ]); |
3662 | 3642 | }); |
3663 | 3643 | 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 | + } |
3669 | 3697 | }; |
3670 | 3698 | } |
3671 | 3699 | d3.geo.projection = d3_geo_projection; |
@@ -3748,11 +3776,9 @@ d3 = function() { |
3748 | 3776 | }; |
3749 | 3777 | } |
3750 | 3778 | 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 | + }); |
3756 | 3782 | } |
3757 | 3783 | function d3_geo_equirectangular(λ, φ) { |
3758 | 3784 | return [ λ, φ ]; |
@@ -6955,10 +6981,24 @@ d3 = function() { |
6955 | 6981 | return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); |
6956 | 6982 | } |
6957 | 6983 | 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); |
6959 | 6985 | 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; |
6962 | 7002 | } |
6963 | 7003 | d3.scale.log = function() { |
6964 | 7004 | return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); |
|
0 commit comments