From 8f3086c18c9ef09c72516d70a1595d76b7f637d8 Mon Sep 17 00:00:00 2001 From: Lucky Feng Date: Thu, 26 Nov 2020 13:40:57 +0800 Subject: [PATCH] fix: applyScroll function doesn't work in sync mode(play at a specific time) (#426) applyScroll function should be called after all of new nodes mounted on dom --- src/replay/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/replay/index.ts b/src/replay/index.ts index 7bfc9877..09a45944 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -115,13 +115,6 @@ export class Replayer { this.emitter.on(ReplayerEvents.Flush, () => { const { scrollMap, inputMap } = this.treeIndex.flush(); - for (const d of scrollMap.values()) { - this.applyScroll(d); - } - for (const d of inputMap.values()) { - this.applyInput(d); - } - for (const [frag, parent] of this.fragmentParentMap.entries()) { mirror.map[parent.__sn.id] = parent; /** @@ -138,6 +131,13 @@ export class Replayer { parent.appendChild(frag); } this.fragmentParentMap.clear(); + + for (const d of scrollMap.values()) { + this.applyScroll(d); + } + for (const d of inputMap.values()) { + this.applyInput(d); + } }); const timer = new Timer([], config?.speed || defaultConfig.speed);