From fb3125bcd91718d8a09abb88de9eb26c8035e304 Mon Sep 17 00:00:00 2001 From: Corson-Dosch <hcorson-dosch@usgs.gov> Date: Mon, 16 Dec 2024 00:09:18 -0600 Subject: [PATCH] fix text wrapping in Safari - need dominant baseline for tspans --- src/components/WildfireAerosolsViz.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/WildfireAerosolsViz.vue b/src/components/WildfireAerosolsViz.vue index e25459e..4ae464c 100644 --- a/src/components/WildfireAerosolsViz.vue +++ b/src/components/WildfireAerosolsViz.vue @@ -1462,11 +1462,12 @@ lineNumber = 0, lineHeight = 1.1, // ems width = text.attr("text-width"), + baseline = text.attr("dominant-baseline"), x = text.attr("x"), y = text.attr("y"), dy = parseFloat(text.attr("dy")), dx = parseFloat(text.attr("dx")), - tspan = text.text(null).append("tspan").attr("y", y).attr("dy", dy + "em"); + tspan = text.text(null).append("tspan").attr("y", y).attr("dy", dy + "em").attr("dominant-baseline", baseline); while ((word = words.pop())) { line.push(word); @@ -1475,7 +1476,7 @@ line.pop(); tspan.text(line.join(" ")); line = [word]; - tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dx", dx).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word); + tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dx", dx).attr("dy", ++lineNumber * lineHeight + dy + "em").attr("dominant-baseline", baseline).text(word); } } -- GitLab