Merge branch 'hotfix/cjc' into 'main'

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

See merge request phenomLi/StructV2!13
This commit is contained in:
chen jiancheng 2022-03-10 05:47:28 +00:00
commit e238087f3f
5 changed files with 109 additions and 43 deletions

View File

@ -1,45 +1,106 @@
const SOURCES_DATA = [{ const SOURCES_DATA = [{
"HashTable": { "LinkList0": {
"data": [{ "data": [{
"id": "0x616eb0", "id": "0x616eb0",
"index": 0, "data": "Z",
"external": "H", "next": "0x616ef0",
"data": "", "loopNext": null,
"disable": true, "rootExternal": [
"empty": true "L"
}, ],
{ "type": "default"
"id": "0x616ec0",
"index": 1,
"data": "UV",
"disable": true,
},
{
"id": "0x616ed0",
"index": 2,
"data": "FI"
},
{
"id": "0x616ee0",
"index": 3,
"data": "",
"disable": true,
"empty": true
}, },
{ {
"freed": true,
"id": "0x616ef0", "id": "0x616ef0",
"index": 4, "data": "",
"data": "SO" "next": "0x605010",
"loopNext": null,
"type": "default"
}, },
{ {
"id": "0x616f00", "id": "0x605010",
"index": 5, "data": "1",
"data": "", "external": [
"disable": true, "t"
"empty": true ],
"next": null,
"loopNext": null,
"type": "default"
} }
], ],
"layouter": "HashTable" "layouter": "LinkList"
}, },
"isEnterFunction": false "handleUpdate": {
"isEnterFunction": false,
"isFirstDebug": false
}
}, {
"LinkList0": {
"data": [{
"id": "0x616eb0",
"data": "Z",
"external": [
"L"
],
"next": "0x616ef0",
"loopNext": null
},
{
"freed": true,
"id": "0x616ef0",
"data": "",
"next": "0x605010",
"loopNext": null
},
{
"id": "0x605010",
"data": "1",
"external": [
"t"
],
"next": null,
"loopNext": null
}
],
"layouter": "LinkList"
},
"handleUpdate": {
"isEnterFunction": false,
"isFirstDebug": false
}
}, {
"LinkList0": {
"data": [{
"id": "0x616eb0",
"data": "Z",
"external": [
"L"
],
"next": "0x616ef0",
"loopNext": null
},
{
"freed": true,
"id": "0x616ef0",
"data": "",
"next": "0x605010",
"loopNext": null
},
{
"id": "0x605010",
"data": "1",
"external": [
"t"
],
"next": null,
"loopNext": null
}
],
"layouter": "LinkList"
},
"handleUpdate": {
"isEnterFunction": false,
"isFirstDebug": false
}
}]; }];

View File

@ -422,13 +422,13 @@ export class Reconcile {
* @param diffResult * @param diffResult
* @param isFirstRender * @param isFirstRender
*/ */
public patch(diffResult: DiffResult,isEnterFunction: boolean) { public patch(diffResult: DiffResult,handleUpdata: any) {
const { APPEND, REMOVE, FREED, LEAKED, UPDATE, CONTINUOUS, ACCUMULATE_LEAK } = diffResult; const { APPEND, REMOVE, FREED, LEAKED, UPDATE, CONTINUOUS, ACCUMULATE_LEAK } = diffResult;
this.handleAccumulateLeakModels(ACCUMULATE_LEAK); this.handleAccumulateLeakModels(ACCUMULATE_LEAK);
// 第一次渲染的时候不高亮变化的元素 // 第一次渲染和进入函数的时候不高亮变化的元素
if (this.isFirstPatch === false && !isEnterFunction) { if (this.isFirstPatch === false && !handleUpdata.isEnterFunction && !handleUpdata.isFirstDebug) {
this.handleChangeModels(UPDATE); this.handleChangeModels(UPDATE);
} }

View File

@ -140,7 +140,7 @@ export class ViewContainer {
* @param models * @param models
* @param layoutFn * @param layoutFn
*/ */
render(layoutGroupTable: LayoutGroupTable, isSameSources: boolean, isEnterFunction: boolean) { render(layoutGroupTable: LayoutGroupTable, isSameSources: boolean, handleUpdata: any) {
const modelList = Util.convertGroupTable2ModelList(layoutGroupTable); const modelList = Util.convertGroupTable2ModelList(layoutGroupTable);
// 如果数据没变的话 // 如果数据没变的话
@ -154,7 +154,7 @@ export class ViewContainer {
this.prevModelList, this.prevModelList,
modelList, modelList,
this.accumulateLeakModels, this.accumulateLeakModels,
isEnterFunction handleUpdata.isEnterFunction
), ),
renderModelList = [...modelList, ...diffResult.REMOVE, ...diffResult.LEAKED, ...diffResult.ACCUMULATE_LEAK]; renderModelList = [...modelList, ...diffResult.REMOVE, ...diffResult.LEAKED, ...diffResult.ACCUMULATE_LEAK];
@ -182,7 +182,7 @@ export class ViewContainer {
this.beforeRender(); this.beforeRender();
this.renderer.render(renderModelList); // 渲染视图 this.renderer.render(renderModelList); // 渲染视图
this.reconcile.patch(diffResult,isEnterFunction); // 对视图上的某些变化进行对应的动作,比如:节点创建动画,节点消失动画等 this.reconcile.patch(diffResult,handleUpdata); // 对视图上的某些变化进行对应的动作,比如:节点创建动画,节点消失动画等
this.afterRender(); this.afterRender();
this.layoutGroupTable = layoutGroupTable; this.layoutGroupTable = layoutGroupTable;

View File

@ -59,7 +59,7 @@ export class Engine {
return; return;
} }
let isEnterFunction = source.isEnterFunction, let handleUpdate = source.handleUpdate,
stringSource = JSON.stringify(source); stringSource = JSON.stringify(source);
if (this.prevStringSource === stringSource) { if (this.prevStringSource === stringSource) {
@ -79,7 +79,7 @@ export class Engine {
} }
// 2 渲染使用g6进行渲染 // 2 渲染使用g6进行渲染
this.viewContainer.render(layoutGroupTable, isSameSources, isEnterFunction); this.viewContainer.render(layoutGroupTable, isSameSources, handleUpdate);
} }

View File

@ -14,14 +14,19 @@ export interface SourceNode {
[key: string]: any | sourceLinkData | sourceMarkerData; [key: string]: any | sourceLinkData | sourceMarkerData;
} }
export interface handleUpdata {
isEnterFunction: boolean,
isFirstDebug: boolean
}
export type Sources = { export type Sources = {
enterFunction: any;
[key: string]: { [key: string]: {
data: SourceNode[]; data: SourceNode[];
layouter: string; layouter: string;
}; };
isEnterFunction?: any; handleUpdata?:any
}; };