Fix:修复画布尺寸调整后第一次触发渲染画布会发生跳动的问题

This commit is contained in:
街角小林
2024-07-31 10:53:56 +08:00
parent 9b40a7bedd
commit 83b6d5793b

View File

@@ -208,8 +208,14 @@ class MindMap {
// 容器尺寸变化,调整尺寸
resize() {
const oldWidth = this.width
const oldHeight = this.height
this.getElRectInfo()
this.svg.size(this.width, this.height)
if (oldWidth !== this.width || oldHeight !== this.height) {
// 如果画布宽高改变了需要触发一次渲染
this.render()
}
this.emit('resize')
}