(project)
| 12608 | } |
| 12609 | |
| 12610 | function mercatorProjection(project) { |
| 12611 | var m = projection(project), |
| 12612 | center = m.center, |
| 12613 | scale = m.scale, |
| 12614 | translate = m.translate, |
| 12615 | clipExtent = m.clipExtent, |
| 12616 | x0 = null, y0, x1, y1; // clip extent |
| 12617 | |
| 12618 | m.scale = function(_) { |
| 12619 | return arguments.length ? (scale(_), reclip()) : scale(); |
| 12620 | }; |
| 12621 | |
| 12622 | m.translate = function(_) { |
| 12623 | return arguments.length ? (translate(_), reclip()) : translate(); |
| 12624 | }; |
| 12625 | |
| 12626 | m.center = function(_) { |
| 12627 | return arguments.length ? (center(_), reclip()) : center(); |
| 12628 | }; |
| 12629 | |
| 12630 | m.clipExtent = function(_) { |
| 12631 | return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; |
| 12632 | }; |
| 12633 | |
| 12634 | function reclip() { |
| 12635 | var k = pi$1 * scale(), |
| 12636 | t = m(rotation(m.rotate()).invert([0, 0])); |
| 12637 | return clipExtent(x0 == null |
| 12638 | ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw |
| 12639 | ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] |
| 12640 | : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]); |
| 12641 | } |
| 12642 | |
| 12643 | return reclip(); |
| 12644 | } |
| 12645 | |
| 12646 | function tany(y) { |
| 12647 | return tan((halfPi$1 + y) / 2); |
no test coverage detected