UNPKG

uzb-d3-map

Version:

A flexible, customizable SVG map component for Uzbekistan built with D3 and React

19 lines 605 B
export function measureLines(svg, lines, fontSize = 12, fontWeight = 700) { const tmp = svg .append("text") .attr("x", -9999) .attr("y", -9999) .attr("font-size", fontSize) .attr("font-weight", fontWeight) .attr("text-anchor", "middle") .attr("dominant-baseline", "middle"); lines.forEach((ln, i) => tmp .append("tspan") .text(ln) .attr("x", -9999) .attr("dy", i === 0 ? 0 : 16)); const b = tmp.node().getBBox(); tmp.remove(); return { w: b.width, h: b.height }; } //# sourceMappingURL=text.js.map