MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / drawMap

Function drawMap

src/Components/WorldMap/display.js:42–66  ·  view source on GitHub ↗
(static_container, mode)

Source from the content-addressed store, hash-verified

40}
41
42function drawMap(static_container, mode) {
43 const static_ctx = static_container.getContext("2d");
44 static_ctx.clearRect(0, 0, static_container.width, static_container.height);
45
46 projection = d3.geoNaturalEarth1()
47 .fitSize([width, height], cachedData)
48
49 shanghai_projected = projection(shanghai);
50
51 const path = d3.geoPath()
52 .projection(projection)
53 .context(static_ctx);
54
55 static_ctx.fillStyle = color[mode].country_fill;
56 static_ctx.strokeStyle = color[mode].country_border;
57
58 static_ctx.globalAlpha = 1.0;
59 static_ctx.filter = "none";
60 cachedData.features.forEach(feature => {
61 static_ctx.beginPath();
62 path(feature);
63 static_ctx.fill();
64 static_ctx.stroke();
65 });
66}
67
68/**
69 * Based on snap.svg bezlen() function

Callers 1

initMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected