"use strict"; function drawMarkers() { TIME && console.time("drawMarkers"); const rescale = +markers.attr("rescale"); const pinned = +markers.attr("pinned"); const markersData = pinned ? pack.markers.filter(({pinned}) => pinned) : pack.markers; const html = markersData.map(marker => drawMarker(marker, rescale)); markers.html(html.join("")); TIME && console.timeEnd("drawMarkers"); } // prettier-ignore const pinShapes = { bubble: (fill, stroke) => ``, pin: (fill, stroke) => ``, square: (fill, stroke) => ``, squarish: (fill, stroke) => ``, diamond: (fill, stroke) => ``, hex: (fill, stroke) => ``, hexy: (fill, stroke) => ``, shieldy: (fill, stroke) => ``, shield: (fill, stroke) => ``, pentagon: (fill, stroke) => ``, heptagon: (fill, stroke) => ``, circle: (fill, stroke) => ``, no: () => "" }; const getPin = (shape = "bubble", fill = "#fff", stroke = "#000") => { const shapeFunction = pinShapes[shape] || pinShapes.bubble; return shapeFunction(fill, stroke); }; function drawMarker(marker, rescale = 1) { const {i, icon, x, y, dx = 50, dy = 50, px = 12, size = 30, pin, fill, stroke} = marker; const id = `marker${i}`; const zoomSize = rescale ? Math.max(rn(size / 5 + 24 / scale, 2), 1) : size; const viewX = rn(x - zoomSize / 2, 1); const viewY = rn(y - zoomSize, 1); const isExternal = icon.startsWith("http"); return /* html */ ` ${getPin(pin, fill, stroke)} ${isExternal ? "" : icon} `; }