map = (projection) => {
const height = width / 2;
const context = DOM.context2d(width, height);
var path = d3.geoPath(projection, context);
var angle = projection.angle();
projection.fitExtent(
[
[2, 2],
[width - 2, height - 2]
],
{ type: "Sphere" }
);
context.clearRect(0, 0, width, width / 2);
countries.features.forEach((c, i) => {
context.beginPath();
path(c);
context.fillStyle = colors[i % colors.length];
context.fill();
(context.strokeStyle = "#FFF"), context.stroke();
});
context.beginPath(), path({ type: "Sphere" });
context.lineWidth = 0.5;
context.setLineDash([3, 4]);
context.strokeStyle = "#888";
context.stroke();
return context.canvas;
};