Fix:修复画布尺寸调整后第一次触发渲染画布会发生跳动的问题
This commit is contained in:
parent
9b40a7bedd
commit
83b6d5793b
@ -208,8 +208,14 @@ class MindMap {
|
|||||||
|
|
||||||
// 容器尺寸变化,调整尺寸
|
// 容器尺寸变化,调整尺寸
|
||||||
resize() {
|
resize() {
|
||||||
|
const oldWidth = this.width
|
||||||
|
const oldHeight = this.height
|
||||||
this.getElRectInfo()
|
this.getElRectInfo()
|
||||||
this.svg.size(this.width, this.height)
|
this.svg.size(this.width, this.height)
|
||||||
|
if (oldWidth !== this.width || oldHeight !== this.height) {
|
||||||
|
// 如果画布宽高改变了需要触发一次渲染
|
||||||
|
this.render()
|
||||||
|
}
|
||||||
this.emit('resize')
|
this.emit('resize')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user