fix trace replay stopping randomly / at high speed

This commit is contained in:
Matthias Wirth
2025-04-30 17:50:51 +00:00
parent e294039e8b
commit f3284edd22
2 changed files with 7 additions and 3 deletions

View File

@@ -1142,7 +1142,6 @@ PlaneObject.prototype.processTrace = function() {
_now = timestamp;
if (traceOpts.showTime && timestamp > traceOpts.showTime) {
traceOpts.showTimeEnd = timestamp;
if (traceOpts.replaySpeed > 0) {
clearTimeout(traceOpts.showTimeout);
traceOpts.animateRealtime = (timestamp - traceOpts.showTime) * 1000;
@@ -1154,9 +1153,12 @@ PlaneObject.prototype.processTrace = function() {
traceOpts.animateStepTime = traceOpts.animateRealtime / traceOpts.replaySpeed / traceOpts.animateSteps;
if (traceOpts.animateSteps < 2) {
traceOpts.showTimeout = setTimeout(gotoTime, traceOpts.animateTime);
traceOpts.animate = false;
//console.log(`animateTime: ${traceOpts.animateTime}`);
traceOpts.showTime = timestamp;
traceOpts.showTimeout = setTimeout(gotoTime, traceOpts.animateTime);
} else {
traceOpts.showTimeEnd = timestamp;
//console.timeEnd('step');
//console.time('step');
//console.log(traceOpts.animateTime);

View File

@@ -7117,6 +7117,7 @@ function drawOutlineJson() {
}
function gotoTime(timestamp) {
//console.log(`gotoTime(${timestamp}) animate: {${traceOpts.animate}}`);
clearTimeout(traceOpts.showTimeout);
if (timestamp) {
traceOpts.showTime = timestamp;
@@ -7136,10 +7137,11 @@ function gotoTime(timestamp) {
if (--traceOpts.animateCounter == 1) {
traceOpts.animate = false;
traceOpts.showTime = traceOpts.showTimeEnd;
console.log(traceOpts.showTime);
}
traceOpts.animateStepTime = traceOpts.animateRealtime / traceOpts.replaySpeed / traceOpts.animateSteps;
clearTimeout(traceOpts.showTimeout);
//console.log(`setTimeout(gotoTime, (${traceOpts.animateStepTime}))`);
traceOpts.showTimeout = setTimeout(gotoTime, traceOpts.animateStepTime);
}
}