From 94c890088355ac3ea71b4e23f0a1616ee690c7fa Mon Sep 17 00:00:00 2001 From: Luis Camacho Date: Sun, 22 May 2022 17:41:52 +0100 Subject: [PATCH] ensure single-line label when rendering across segments --- src/ol/geom/flat/textpath.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ol/geom/flat/textpath.js b/src/ol/geom/flat/textpath.js index 18eff716a4..4124320b3d 100644 --- a/src/ol/geom/flat/textpath.js +++ b/src/ol/geom/flat/textpath.js @@ -104,6 +104,9 @@ export function drawTextOnPath( return result; } + // rendering across line segments + text = text.replace(/\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines + for (let i = 0, ii = text.length; i < ii; ) { advance(); let angle = Math.atan2(y2 - y1, x2 - x1);