Merge branch 'hotfix/cjc' into 'main'
修复刚开始调试时结点变色的bug See merge request phenomLi/StructV2!13
This commit is contained in:
commit
e238087f3f
127
demo/data.js
127
demo/data.js
@ -1,45 +1,106 @@
|
||||
const SOURCES_DATA = [{
|
||||
"HashTable": {
|
||||
"LinkList0": {
|
||||
"data": [{
|
||||
"id": "0x616eb0",
|
||||
"index": 0,
|
||||
"external": "H",
|
||||
"data": "",
|
||||
"disable": true,
|
||||
"empty": true
|
||||
},
|
||||
{
|
||||
"id": "0x616ec0",
|
||||
"index": 1,
|
||||
"data": "UV",
|
||||
"disable": true,
|
||||
},
|
||||
{
|
||||
"id": "0x616ed0",
|
||||
"index": 2,
|
||||
"data": "FI"
|
||||
},
|
||||
{
|
||||
"id": "0x616ee0",
|
||||
"index": 3,
|
||||
"data": "",
|
||||
"disable": true,
|
||||
"empty": true
|
||||
"data": "Z",
|
||||
"next": "0x616ef0",
|
||||
"loopNext": null,
|
||||
"rootExternal": [
|
||||
"L"
|
||||
],
|
||||
"type": "default"
|
||||
},
|
||||
{
|
||||
"freed": true,
|
||||
"id": "0x616ef0",
|
||||
"index": 4,
|
||||
"data": "SO"
|
||||
"data": "",
|
||||
"next": "0x605010",
|
||||
"loopNext": null,
|
||||
"type": "default"
|
||||
},
|
||||
{
|
||||
"id": "0x616f00",
|
||||
"index": 5,
|
||||
"data": "",
|
||||
"disable": true,
|
||||
"empty": true
|
||||
"id": "0x605010",
|
||||
"data": "1",
|
||||
"external": [
|
||||
"t"
|
||||
],
|
||||
"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
|
||||
}
|
||||
}];
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user