Feat:修复导入含有和当前画布已有节点uid相同的文件时会重复绘制节点的问题

This commit is contained in:
街角小林 2023-12-14 17:17:25 +08:00
parent d517ee338f
commit 0ec16bd136
2 changed files with 6 additions and 3 deletions

View File

@ -162,15 +162,14 @@ class MindMap {
render(callback, source = '') { render(callback, source = '') {
this.batchExecution.push('render', () => { this.batchExecution.push('render', () => {
this.initTheme() this.initTheme()
this.renderer.reRender = false
this.renderer.render(callback, source) this.renderer.render(callback, source)
}) })
} }
// 重新渲染 // 重新渲染
reRender(callback, source = '') { reRender(callback, source = '') {
this.clearDraw() // 清空画布的操作不能放到队列任务里否则当reRender后又执行了render当前回调会被覆盖掉
this.batchExecution.push('render', () => { this.batchExecution.push('render', () => {
this.clearDraw()
this.initTheme() this.initTheme()
this.renderer.reRender = true this.renderer.reRender = true
this.renderer.render(callback, source) this.renderer.render(callback, source)
@ -495,7 +494,10 @@ class MindMap {
} }
// 移除插件 // 移除插件
;[...MindMap.pluginList].forEach(plugin => { ;[...MindMap.pluginList].forEach(plugin => {
if (this[plugin.instanceName] && this[plugin.instanceName].beforePluginDestroy) { if (
this[plugin.instanceName] &&
this[plugin.instanceName].beforePluginDestroy
) {
this[plugin.instanceName].beforePluginDestroy() this[plugin.instanceName].beforePluginDestroy()
} }
this[plugin.instanceName] = null this[plugin.instanceName] = null

View File

@ -431,6 +431,7 @@ class Render {
this.waitRenderingParams = [] this.waitRenderingParams = []
this.render(...params) this.render(...params)
} else { } else {
if (this.reRender) this.reRender = false
// 触发一次保存,因为修改了渲染树的数据 // 触发一次保存,因为修改了渲染树的数据
if ( if (
this.mindMap.richText && this.mindMap.richText &&