Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | export function sanitizeForClassName(str: string): string { return str.replace(/[^a-z0-9]/gi, "_"); } export function getPathLengthAtX(path: SVGPathElement, x: number): number | undefined { const l = path.getTotalLength(); const precision = 90; if (!path || path.getTotalLength() === 0) { return 0; } for (let i = 0; i <= precision; i++) { const pos = path.getPointAtLength((l * i) / precision); if (pos.x >= x) return (l * i) / precision; } } export function getColor(mappedColor?: string, dataColor?: string): string { const FALLBACK_COLOR = "rgba(253, 253, 253, 0.5)"; if (mappedColor) return mappedColor; if (dataColor) return dataColor; return FALLBACK_COLOR; } |