Browse Source

need to fix text geo creation

master
Cailean Finn 6 months ago
parent
commit
9c0f5f4bb5
  1. 9
      public/js/main.js

9
public/js/main.js

@ -330,6 +330,7 @@ function ClearTextGeoList() {
function MeasureText(text) { function MeasureText(text) {
fontLoader.load('fonts/Redaction 50_Regular.json', (font) => { fontLoader.load('fonts/Redaction 50_Regular.json', (font) => {
ClearTextGeoList();
let initialFontSize = 1; let initialFontSize = 1;
if (window.innerWidth < 1024) { if (window.innerWidth < 1024) {
initialFontSize = 0.5; initialFontSize = 0.5;
@ -346,7 +347,8 @@ function MeasureText(text) {
height: 2, height: 2,
depth: 1, depth: 1,
font: font, font: font,
size: size size: size,
curveSegments: 1
}); });
} }
@ -374,11 +376,12 @@ function MeasureText(text) {
currentText = testText; currentText = testText;
} }
} }
if (currentText) { if (currentText) {
sentences.push(currentText); sentences.push(currentText);
} }
ClearTextGeoList();
const numSentences = sentences.length; const numSentences = sentences.length;
const totalHeight = (numSentences - 1) * (1.5 * currentFontSize); const totalHeight = (numSentences - 1) * (1.5 * currentFontSize);
@ -414,7 +417,7 @@ function MeasureText(text) {
} }
}); });
} }
window.addEventListener('mousemove', setPickPosition); window.addEventListener('mousemove', setPickPosition);
window.addEventListener('mouseout', clearPickPosition); window.addEventListener('mouseout', clearPickPosition);
window.addEventListener('mouseleave', clearPickPosition); window.addEventListener('mouseleave', clearPickPosition);

Loading…
Cancel
Save