fix trace replay stopping randomly / at high speed
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user