style: improve code formatting in draw-markers.ts for better readability

This commit is contained in:
Azgaar 2026-03-07 18:21:15 +01:00
parent 74952a1071
commit df56e188db

View file

@ -1,4 +1,4 @@
import {rn} from "../utils";
import { rn } from "../utils";
interface Marker {
i: number;
@ -22,7 +22,7 @@ declare global {
}
type PinShapeFunction = (fill: string, stroke: string) => string;
type PinShapes = {[key: string]: PinShapeFunction};
type PinShapes = { [key: string]: PinShapeFunction };
// prettier-ignore
const pinShapes: PinShapes = {
@ -59,7 +59,19 @@ const getPin = (shape = "bubble", fill = "#fff", stroke = "#000"): string => {
};
function markerRenderer(marker: Marker, rescale = 1): string {
const {i, icon, x, y, dx = 50, dy = 50, px = 12, size = 30, pin, fill, stroke} = marker;
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);
@ -81,8 +93,10 @@ const markersRenderer = (): void => {
const rescale = +markers.attr("rescale");
const pinned = +markers.attr("pinned");
const markersData: Marker[] = pinned ? pack.markers.filter((m: Marker) => m.pinned) : pack.markers;
const html = markersData.map(marker => markerRenderer(marker, rescale));
const markersData: Marker[] = pinned
? pack.markers.filter((m: Marker) => m.pinned)
: pack.markers;
const html = markersData.map((marker) => markerRenderer(marker, rescale));
markers.html(html.join(""));
TIME && console.timeEnd("drawMarkers");