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

Function initMap

src/Components/WorldMap/display.js:280–305  ·  view source on GitHub ↗
(staticContainer, dynamicContainer, mapWidth, mapHeight, mode)

Source from the content-addressed store, hash-verified

278}
279
280export function initMap(staticContainer, dynamicContainer, mapWidth, mapHeight, mode) {
281 if (animationId !== null) {
282 cancelAnimationFrame(animationId);
283 }
284 canvas = dynamicContainer;
285 width = mapWidth;
286 height = mapHeight;
287 proportion = width / 1700;
288 initCanvas(staticContainer);
289 initCanvas(dynamicContainer);
290 ctx = canvas.getContext("2d");
291 drawMap(staticContainer, mode);
292 redraw(mode);
293
294 return () => {
295 if (canvas === dynamicContainer) {
296 cancelAnimationFrame(animationId);
297 clearTimeout(forceTimeoutId);
298 animationId = null;
299 forceTimeoutId = null;
300 force = false;
301 canvas = null;
302 ctx = null;
303 }
304 };
305}
306
307export function clickHandler(e) {
308 const {left, top} = e.currentTarget.getBoundingClientRect();

Callers 1

WorldMapFunction · 0.90

Calls 3

initCanvasFunction · 0.85
drawMapFunction · 0.85
redrawFunction · 0.85

Tested by

no test coverage detected