This commit is contained in:
2026-02-04 10:48:31 +02:00
parent ff6418c244
commit edd4dcfd0a
5 changed files with 24 additions and 5 deletions
+13 -3
View File
@@ -5,6 +5,7 @@ import {
import { Text } from "troika-three-text";
import { EventManager } from "./EventManager";
import Utils from "./Utils";
class DashBoard extends EventManager {
#points = 0;
constructor(engine) {
@@ -133,13 +134,13 @@ class DashBoard extends EventManager {
});
}
this.updateText = function(t, textScrolledCallback){
this.updateText = function(t, hideOnFinish = false, textScrolledCallback){
if (!textPlane) return;
textPlane.visible = !!t;
engine.motionQueue.clear(text);
text.text = t;
text.anchorY = 0.03 * dashHeight;
text.sync(()=>{
text.sync(async()=>{
let dMax = text.textRenderInfo.blockBounds[3] - text.textRenderInfo.blockBounds[1];
let dh = dMax + text.clipRect[1];
if (dh > 0){
@@ -148,6 +149,9 @@ class DashBoard extends EventManager {
if (text.textRenderInfo.blockBounds[1]> text.clipRect[1] * 1.33 ){
textScrolledCallback?.(true);
textScrolledCallback = null;
if (hideOnFinish){
this.updateText('')
}
}
}
engine.motionQueue.add({
@@ -157,7 +161,13 @@ class DashBoard extends EventManager {
u: updateFn
})
}else{
textScrolledCallback?.(false)
if (hideOnFinish){
await Utils.wait(10000);
this.updateText('')
textScrolledCallback?.(false)
}else{
textScrolledCallback?.(false)
}
}
})
}