From 9c0f5f4bb5c4505bc9e991a067d17ceb7e45a326 Mon Sep 17 00:00:00 2001 From: Cailean Finn Date: Tue, 18 Jun 2024 22:41:48 +0100 Subject: [PATCH] need to fix text geo creation --- public/js/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index 33882d9..a9b067e 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -330,6 +330,7 @@ function ClearTextGeoList() { function MeasureText(text) { fontLoader.load('fonts/Redaction 50_Regular.json', (font) => { + ClearTextGeoList(); let initialFontSize = 1; if (window.innerWidth < 1024) { initialFontSize = 0.5; @@ -346,7 +347,8 @@ function MeasureText(text) { height: 2, depth: 1, font: font, - size: size + size: size, + curveSegments: 1 }); } @@ -374,11 +376,12 @@ function MeasureText(text) { currentText = testText; } } + if (currentText) { sentences.push(currentText); } - ClearTextGeoList(); + const numSentences = sentences.length; const totalHeight = (numSentences - 1) * (1.5 * currentFontSize); @@ -414,7 +417,7 @@ function MeasureText(text) { } }); } - + window.addEventListener('mousemove', setPickPosition); window.addEventListener('mouseout', clearPickPosition); window.addEventListener('mouseleave', clearPickPosition);