UNPKG

@frontify/fondue-charts

Version:

Frontify's data viz library

15 lines (14 loc) • 735 B
const n = "__react_svg_text_measurement_id", l = (s, i) => { let e = document.getElementById(n); if (!e) { const t = document.createElementNS("http://www.w3.org/2000/svg", "svg"); t.setAttribute("aria-hidden", "true"), t.style.width = "0", t.style.height = "0", t.style.position = "absolute", t.style.top = "-100%", t.style.left = "-100%", e = document.createElementNS("http://www.w3.org/2000/svg", "text"), e.setAttribute("id", n), t.appendChild(e), document.body.appendChild(t); } Object.assign(e.style, i), e.textContent = s; const { width: o, height: d } = e.getBoundingClientRect(); return { width: o, height: d }; }; export { l as getSVGTextDimensions }; //# sourceMappingURL=getSVGTextDimensions.es.js.map