MCPcopy Create free account
hub / github.com/breck7/scroll / projectionMutator

Function projectionMutator

external/.d3.js:12253–12368  ·  view source on GitHub ↗
(projectAt)

Source from the content-addressed store, hash-verified

12251}
12252
12253function projectionMutator(projectAt) {
12254 var project,
12255 k = 150, // scale
12256 x = 480, y = 250, // translate
12257 lambda = 0, phi = 0, // center
12258 deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate
12259 alpha = 0, // post-rotate angle
12260 sx = 1, // reflectX
12261 sy = 1, // reflectX
12262 theta = null, preclip = clipAntimeridian, // pre-clip angle
12263 x0 = null, y0, x1, y1, postclip = identity$5, // post-clip extent
12264 delta2 = 0.5, // precision
12265 projectResample,
12266 projectTransform,
12267 projectRotateTransform,
12268 cache,
12269 cacheStream;
12270
12271 function projection(point) {
12272 return projectRotateTransform(point[0] * radians, point[1] * radians);
12273 }
12274
12275 function invert(point) {
12276 point = projectRotateTransform.invert(point[0], point[1]);
12277 return point && [point[0] * degrees, point[1] * degrees];
12278 }
12279
12280 projection.stream = function(stream) {
12281 return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
12282 };
12283
12284 projection.preclip = function(_) {
12285 return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;
12286 };
12287
12288 projection.postclip = function(_) {
12289 return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
12290 };
12291
12292 projection.clipAngle = function(_) {
12293 return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;
12294 };
12295
12296 projection.clipExtent = function(_) {
12297 return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$5) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
12298 };
12299
12300 projection.scale = function(_) {
12301 return arguments.length ? (k = +_, recenter()) : k;
12302 };
12303
12304 projection.translate = function(_) {
12305 return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
12306 };
12307
12308 projection.center = function(_) {
12309 return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
12310 };

Callers 2

projectionFunction · 0.85
conicProjectionFunction · 0.85

Calls 10

transformRotateFunction · 0.85
resetFunction · 0.85
clipCircleFunction · 0.85
clipRectangleFunction · 0.85
recenterFunction · 0.85
resampleFunction · 0.85
fitExtentFunction · 0.85
fitSizeFunction · 0.85
fitWidthFunction · 0.85
fitHeightFunction · 0.85

Tested by

no test coverage detected