fix resume to move baseline time by time offset

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 6f06b5e1e7
commit e5928fc311

View File

@@ -111,6 +111,7 @@ export class Replayer {
public resume(timeOffset = 0) { public resume(timeOffset = 0) {
this.timer.clear(); this.timer.clear();
this.baselineTime = this.events[0].timestamp + timeOffset;
const actions = new Array<actionWithDelay>(); const actions = new Array<actionWithDelay>();
for (const event of this.events) { for (const event of this.events) {
if ( if (
@@ -119,11 +120,10 @@ export class Replayer {
) { ) {
continue; continue;
} }
const delayToBaseline = this.getDelay(event);
const castFn = this.getCastFn(event); const castFn = this.getCastFn(event);
actions.push({ actions.push({
doAction: castFn, doAction: castFn,
delay: delayToBaseline - timeOffset, delay: this.getDelay(event),
}); });
} }
this.timer.addActions(actions); this.timer.addActions(actions);