Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
prototype.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
shape = this.value,
as = _.as || 'shape',
flag = out.ADD;
if (!shape || _.modified()) {
// parameters updated, reset and reflow
this.value = shape = shapeGenerator(
getProjectionPath(_.projection),
_.field || field('datum'),
_.pointRadius
);
out.materialize().reflow();
flag = out.SOURCE;
}
out.visit(flag, function(t) { t[as] = shape; });
return out.modifies(as);
};
prototype.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
path = this.value,
field = _.field || identity,
as = _.as || 'path',
flag = out.SOURCE;
function set(t) { t[as] = path(field(t)); }
if (!path || _.modified()) {
// parameters updated, reset and reflow
this.value = path = getProjectionPath(_.projection);
out.materialize().reflow();
} else {
flag = field === identity || pulse.modified(field.fields)
? out.ADD_MOD
: out.ADD;
}
var prev = initPath(path, _.pointRadius);
out.visit(flag, set);
path.pointRadius(prev);
return out.modifies(as);
};
prototype.transform = function(_, pulse) {
var proj = this.value;
if (!proj || _.modified('type')) {
this.value = (proj = create(_.type));
projectionProperties.forEach(function(prop) {
if (_[prop] != null) set(proj, prop, _[prop]);
});
} else {
projectionProperties.forEach(function(prop) {
if (_.modified(prop)) set(proj, prop, _[prop]);
});
}
if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);
if (_.fit) fit(proj, _);
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
};
].forEach(function(p) {
projection(p, d3['geo' + p[0].toUpperCase() + p.slice(1)]);
});
function create(type) {
var constructor = projection((type || 'mercator').toLowerCase());
if (!constructor) error('Unrecognized projection type: ' + type);
return constructor();
}