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

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