优化:重新渲染时清空节点池
This commit is contained in:
parent
6b15e469a2
commit
d7b1c4e4fe
@ -257,6 +257,7 @@ class Render {
|
|||||||
// 重新渲染需要清除激活状态
|
// 重新渲染需要清除激活状态
|
||||||
if (this.reRender) {
|
if (this.reRender) {
|
||||||
this.clearActive()
|
this.clearActive()
|
||||||
|
this.layout.clearNodePool()
|
||||||
}
|
}
|
||||||
// 计算布局
|
// 计算布局
|
||||||
this.layout.doLayout(root => {
|
this.layout.doLayout(root => {
|
||||||
|
|||||||
@ -43,10 +43,15 @@ class Base {
|
|||||||
this.nodePool[uid] = node
|
this.nodePool[uid] = node
|
||||||
// 如果总缓存数量达到1000,直接清空
|
// 如果总缓存数量达到1000,直接清空
|
||||||
if (Object.keys(this.nodePool).length > 1000) {
|
if (Object.keys(this.nodePool).length > 1000) {
|
||||||
this.nodePool = {}
|
this.clearNodePool()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清空节点存储池
|
||||||
|
clearNodePool() {
|
||||||
|
this.nodePool = {}
|
||||||
|
}
|
||||||
|
|
||||||
// 检查当前来源是否需要重新计算节点大小
|
// 检查当前来源是否需要重新计算节点大小
|
||||||
checkIsNeedResizeSources() {
|
checkIsNeedResizeSources() {
|
||||||
return [CONSTANTS.CHANGE_THEME, CONSTANTS.TRANSFORM_TO_NORMAL_NODE].includes(this.renderer.renderSource)
|
return [CONSTANTS.CHANGE_THEME, CONSTANTS.TRANSFORM_TO_NORMAL_NODE].includes(this.renderer.renderSource)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user