Merge branch 'hotfix/cjc' into 'main'

增加进入新函数不计算泄露结点的功能

See merge request phenomLi/StructV2!9
This commit is contained in:
chen jiancheng 2022-02-25 09:35:50 +00:00
commit b3b31edd85
6 changed files with 11738 additions and 172 deletions

View File

@ -98,142 +98,140 @@
"BinaryTree0": { "BinaryTree0": {
"data": [{ "data": [{
"external": [ "external": [
"T1" "T"
], ],
"child": [ "child": [
"0x617ee0", "0x616060",
"0x617f10" "0x615f40"
], ],
"id": "0x617eb0", "id": "0x615f10",
"name": "T1", "name": "T",
"data": "Z", "data": "F",
"root": true, "root": true,
"type": "default" "type": "default"
}, { }, {
"child": [ "child": [
"0x0", "0x0",
"0x0" "0x616090"
], ],
"id": "0x617ee0", "id": "0x616060",
"name": "T1->lchild", "name": "T->lchild",
"data": "A", "data": "A",
"type": "default" "type": "default"
}, { }, {
"child": [ "child": [
"0x0", "0x6160c0",
"0x0" "0x0"
], ],
"id": "0x617f10", "id": "0x616090",
"name": "T1->rchild", "name": "(T->lchild)->rchild",
"data": "B", "data": "E",
"type": "default",
"external": [
"r",
"t"
]
}],
"layouter": "BinaryTree"
},
"BinaryTree3": {
"data": [{
"external": [
"T2",
"r2"
],
"child": [
"0x617f70",
"0x0"
],
"id": "0x617f40",
"name": "T2",
"data": "Z",
"root": true,
"type": "default" "type": "default"
}, { }, {
"child": [ "child": [
"0x0", "0x0",
"0x0" "0x0"
], ],
"id": "0x617f70", "id": "0x6160c0",
"name": "T2->lchild", "name": "((T->lchild)->rchild)->lchild",
"data": "D", "data": "D",
"type": "default", "type": "default"
"external": [ }, {
"t2" "child": [
] "0x615f70",
"0x615fd0"
],
"id": "0x615f40",
"name": "T->rchild",
"data": "U",
"type": "default"
}, {
"child": [
"0x615fa0",
"0x616000"
],
"id": "0x615f70",
"name": "(T->rchild)->lchild",
"data": "S",
"type": "default"
}, {
"child": [
"0x0",
"0x0"
],
"id": "0x615fa0",
"name": "((T->rchild)->lchild)->lchild",
"data": "R",
"type": "default"
}, {
"child": [
"0x0",
"0x0"
],
"id": "0x616000",
"name": "((T->rchild)->lchild)->rchild",
"data": "T",
"type": "default"
}, {
"child": [
"0x0",
"0x616030"
],
"id": "0x615fd0",
"name": "(T->rchild)->rchild",
"data": "V",
"type": "default"
}, {
"child": [
"0x0",
"0x0"
],
"id": "0x616030",
"name": "((T->rchild)->rchild)->rchild",
"data": "X",
"type": "default"
}], }],
"layouter": "BinaryTree" "layouter": "BinaryTree"
} },
"isEnterFunction": true
}, { }, {
"BinaryTree0": { "BinaryTree0": {
"data": [{ "data": [{
"external": [ "external": [
"T1" "T"
], ],
"child": [ "child": [
"0x617ee0", "0x0",
"0x617f10" "0x616090"
], ],
"id": "0x617eb0", "id": "0x616060",
"name": "T1", "name": "T",
"data": "Z", "data": "A",
"root": true, "root": true,
"type": "default" "type": "default"
}, {
"child": [
"0x6160c0",
"0x0"
],
"id": "0x616090",
"name": "T->rchild",
"data": "E",
"type": "default"
}, { }, {
"child": [ "child": [
"0x0", "0x0",
"0x0" "0x0"
], ],
"id": "0x617ee0", "id": "0x6160c0",
"name": "T1->lchild", "name": "(T->rchild)->lchild",
"data": "A", "data": "D",
"type": "default"
}, {
"child": [
"0x0",
"0x617eb0"
],
"id": "0x617f10",
"name": "T1->rchild",
"data": "B",
"type": "default" "type": "default"
}], }],
"layouter": "BinaryTree" "layouter": "BinaryTree"
}, },
"isEnterFunction": true
"BinaryTree3": { }];
"data": [{
"external": [
"T2",
"r2"
],
"child": [
"0x617f70",
"0x0"
],
"id": "0x617f40",
"name": "T2",
"data": "Z",
"root": true,
"type": "default"
}, {
"child": [
"0x0",
"0x0"
],
"id": "0x617f70",
"name": "T2->lchild",
"data": "D",
"type": "default",
"external": [
"t2"
]
}],
"layouter": "BinaryTree"
}
}
];
let dataIndex = 0, let dataIndex = 0,
curData = data[dataIndex]; curData = data[dataIndex];

11621
dist/sv.js vendored

File diff suppressed because one or more lines are too long

View File

@ -367,9 +367,9 @@ export class Reconcile {
* @param accumulateLeakModels * @param accumulateLeakModels
* @returns * @returns
*/ */
public diff(layoutGroupTable: LayoutGroupTable, prevModelList: SVModel[], modelList: SVModel[], accumulateLeakModels: SVModel[]): DiffResult { public diff(layoutGroupTable: LayoutGroupTable, prevModelList: SVModel[], modelList: SVModel[], accumulateLeakModels: SVModel[], isEnterFunction: boolean): DiffResult {
const continuousModels: SVModel[] = this.getContinuousModels(prevModelList, modelList); const continuousModels: SVModel[] = this.getContinuousModels(prevModelList, modelList);
const leakModels: SVModel[] = this.getLeakModels(layoutGroupTable, prevModelList, modelList); const leakModels: SVModel[] = isEnterFunction? []: this.getLeakModels(layoutGroupTable, prevModelList, modelList);
const appendModels: SVModel[] = this.getAppendModels(prevModelList, modelList, accumulateLeakModels); const appendModels: SVModel[] = this.getAppendModels(prevModelList, modelList, accumulateLeakModels);
const removeModels: SVModel[] = this.getRemoveModels(prevModelList, modelList); const removeModels: SVModel[] = this.getRemoveModels(prevModelList, modelList);
const updateModels: SVModel[] = [ const updateModels: SVModel[] = [

View File

@ -140,9 +140,9 @@ export class ViewContainer {
* @param models * @param models
* @param layoutFn * @param layoutFn
*/ */
render(layoutGroupTable: LayoutGroupTable) { render(layoutGroupTable: LayoutGroupTable, isEnterFunction: boolean) {
const modelList = Util.convertGroupTable2ModelList(layoutGroupTable), const modelList = Util.convertGroupTable2ModelList(layoutGroupTable),
diffResult = this.reconcile.diff(this.layoutGroupTable, this.prevModelList, modelList, this.accumulateLeakModels), diffResult = this.reconcile.diff(this.layoutGroupTable, this.prevModelList, modelList, this.accumulateLeakModels, isEnterFunction),
renderModelList = [ renderModelList = [
...modelList, ...modelList,
...diffResult.REMOVE, ...diffResult.REMOVE,

View File

@ -67,7 +67,7 @@ export class Engine {
const layoutGroupTable = this.modelConstructor.construct(source); const layoutGroupTable = this.modelConstructor.construct(source);
// 2 渲染使用g6进行渲染 // 2 渲染使用g6进行渲染
this.viewContainer.render(layoutGroupTable); this.viewContainer.render(layoutGroupTable, source.isEnterFunction as boolean);
} }

View File

@ -19,7 +19,8 @@ export type Sources = {
[key: string]: { [key: string]: {
data: SourceNode[]; data: SourceNode[];
layouter: string; layouter: string;
} };
isEnterFunction?: any;
}; };