修复刚开始调试时结点变色的bug

This commit is contained in:
cjc
2022-03-10 13:46:42 +08:00
parent ddc59b32fd
commit 8c9c5ffdcb
5 changed files with 109 additions and 43 deletions
+3 -3
View File
@@ -422,13 +422,13 @@ export class Reconcile {
* @param diffResult
* @param isFirstRender
*/
public patch(diffResult: DiffResult,isEnterFunction: boolean) {
public patch(diffResult: DiffResult,handleUpdata: any) {
const { APPEND, REMOVE, FREED, LEAKED, UPDATE, CONTINUOUS, ACCUMULATE_LEAK } = diffResult;
this.handleAccumulateLeakModels(ACCUMULATE_LEAK);
// 第一次渲染的时候不高亮变化的元素
if (this.isFirstPatch === false && !isEnterFunction) {
// 第一次渲染和进入函数的时候不高亮变化的元素
if (this.isFirstPatch === false && !handleUpdata.isEnterFunction && !handleUpdata.isFirstDebug) {
this.handleChangeModels(UPDATE);
}
+3 -3
View File
@@ -140,7 +140,7 @@ export class ViewContainer {
* @param models
* @param layoutFn
*/
render(layoutGroupTable: LayoutGroupTable, isSameSources: boolean, isEnterFunction: boolean) {
render(layoutGroupTable: LayoutGroupTable, isSameSources: boolean, handleUpdata: any) {
const modelList = Util.convertGroupTable2ModelList(layoutGroupTable);
// 如果数据没变的话
@@ -154,7 +154,7 @@ export class ViewContainer {
this.prevModelList,
modelList,
this.accumulateLeakModels,
isEnterFunction
handleUpdata.isEnterFunction
),
renderModelList = [...modelList, ...diffResult.REMOVE, ...diffResult.LEAKED, ...diffResult.ACCUMULATE_LEAK];
@@ -182,7 +182,7 @@ export class ViewContainer {
this.beforeRender();
this.renderer.render(renderModelList); // 渲染视图
this.reconcile.patch(diffResult,isEnterFunction); // 对视图上的某些变化进行对应的动作,比如:节点创建动画,节点消失动画等
this.reconcile.patch(diffResult,handleUpdata); // 对视图上的某些变化进行对应的动作,比如:节点创建动画,节点消失动画等
this.afterRender();
this.layoutGroupTable = layoutGroupTable;
+2 -2
View File
@@ -59,7 +59,7 @@ export class Engine {
return;
}
let isEnterFunction = source.isEnterFunction,
let handleUpdate = source.handleUpdate,
stringSource = JSON.stringify(source);
if (this.prevStringSource === stringSource) {
@@ -79,7 +79,7 @@ export class Engine {
}
// 2 渲染(使用g6进行渲染)
this.viewContainer.render(layoutGroupTable, isSameSources, isEnterFunction);
this.viewContainer.render(layoutGroupTable, isSameSources, handleUpdate);
}
+7 -2
View File
@@ -14,14 +14,19 @@ export interface SourceNode {
[key: string]: any | sourceLinkData | sourceMarkerData;
}
export interface handleUpdata {
isEnterFunction: boolean,
isFirstDebug: boolean
}
export type Sources = {
enterFunction: any;
[key: string]: {
data: SourceNode[];
layouter: string;
};
isEnterFunction?: any;
handleUpdata?:any
};