!3058 优化: 即时更新模板树的视图效果

pull/3061/MERGE
张子涵 4 weeks ago committed by ChenX
parent da01a3990f
commit 97bb3bacd4

@ -323,9 +323,7 @@ export class TemplateParamPanelStore
//计算可见的节点个数
const ForeachTreeNode = (nodes: ITreeNode[], callback: (node: ITreeNode) => void) =>
{
if (nodes === null)
return;
if (nodes)
for (const node of nodes)
{
callback(node);
@ -334,11 +332,21 @@ export class TemplateParamPanelStore
}
};
// 为了即时更新,该遍历不做展开判断
const ForeachAllTreeNode = (nodes: ITreeNode[], callback: (node: ITreeNode) => void) =>
{
if (nodes)
for (const node of nodes)
{
callback(node);
ForeachAllTreeNode(node.childNodes, callback);
}
};
let height = Math.max(200, this.scrollCard ? this.scrollCard.clientHeight : 200);
ForeachTreeNode(nodes, n =>
{
templateIdSet.add(n.id as number);
n.isSelected = n.nodeData === template;
if (n.isSelected)
{
@ -354,6 +362,8 @@ export class TemplateParamPanelStore
displayNodeCount++;//当前显示的节点个数
});
ForeachAllTreeNode(nodes, n => templateIdSet.add(n.id as number));
//还得判断名字是不是被改了,如果被改了,我们是不是应该刷新节点树? 现在把折叠信息放在模块内,我们记住了折叠信息,这样我们就可以始终刷新这棵树了
//如果顶层发生改变,或者节点树发生改变,那么就要刷新节点树

Loading…
Cancel
Save