From 7eee29ce324abbef263a7067b66fc19717321d03 Mon Sep 17 00:00:00 2001 From: cjc <431909623@qq.com> Date: Thu, 14 Apr 2022 10:17:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=E8=B0=83=E8=AF=95=E6=97=B6=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=B3=84=E6=BC=8F=E5=8C=BA=E5=AF=B9=E6=AF=94=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/View/reconcile.ts | 4 ++-- src/View/viewContainer.ts | 8 ++++++-- src/engine.ts | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/View/reconcile.ts b/src/View/reconcile.ts index f9a790e..d6aa6dc 100644 --- a/src/View/reconcile.ts +++ b/src/View/reconcile.ts @@ -392,10 +392,10 @@ export class Reconcile { prevModelList: SVModel[], modelList: SVModel[], accumulateLeakModels: SVModel[], - isEnterFunction: boolean + isDiffLeak: boolean ): DiffResult { const continuousModels: SVModel[] = this.getContinuousModels(prevModelList, modelList); - const leakModels: SVModel[] = isEnterFunction + const leakModels: SVModel[] = isDiffLeak ? [] : this.getLeakModels(layoutGroupTable, prevModelList, modelList); const appendModels: SVModel[] = this.getAppendModels(prevModelList, modelList, accumulateLeakModels); diff --git a/src/View/viewContainer.ts b/src/View/viewContainer.ts index 62d4c6a..258b9fb 100644 --- a/src/View/viewContainer.ts +++ b/src/View/viewContainer.ts @@ -174,7 +174,7 @@ export class ViewContainer { * @param models * @param layoutFn */ - render(layoutGroupTable: LayoutGroupTable, isSameSources: boolean, handleUpdate: handleUpdate) { + render(layoutGroupTable: LayoutGroupTable, isSameSources: boolean, handleUpdate: handleUpdate,hasTriggerLastStep: boolean) { const modelList = Util.convertGroupTable2ModelList(layoutGroupTable); this.restoreHighlight([...modelList, ...this.accumulateLeakModels]); @@ -184,12 +184,16 @@ export class ViewContainer { return; } + // 判断是否需要进行泄漏区的比较 + let isDiffLeak = handleUpdate.isEnterFunction || hasTriggerLastStep; + const diffResult = this.reconcile.diff( this.layoutGroupTable, this.prevModelList, modelList, this.accumulateLeakModels, - handleUpdate?.isEnterFunction + // handleUpdate?.isEnterFunction + isDiffLeak ), renderModelList = [...modelList, ...diffResult.REMOVE, ...diffResult.LEAKED, ...this.accumulateLeakModels]; diff --git a/src/engine.ts b/src/engine.ts index 4d3e6c3..e72d149 100644 --- a/src/engine.ts +++ b/src/engine.ts @@ -52,7 +52,7 @@ export class Engine { * @param sources * @param prevStep */ - public render(source: Sources) { + public render(source: Sources, hasTriggerLastStep: boolean) { let isSameSources: boolean = false, layoutGroupTable: LayoutGroupTable; @@ -80,7 +80,7 @@ export class Engine { } // 2 渲染(使用g6进行渲染) - this.viewContainer.render(layoutGroupTable, isSameSources, handleUpdate); + this.viewContainer.render(layoutGroupTable, isSameSources, handleUpdate, hasTriggerLastStep); }