Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/extension/src/components/mini-map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ export class MiniMap {
this.bounds = boundsInit
this.elementAreaBounds = boundsInit
this.viewPortBounds = boundsInit
this.initMiniMap()
lf.on('graph:resize', this.onGraphResize)
}

onGraphResize = () => {
Expand Down Expand Up @@ -230,8 +228,10 @@ export class MiniMap {
*/
public show = (left?: number, top?: number) => {
if (!this.isShow) {
this.initMiniMap()
this.lf.on('graph:resize', this.onGraphResize)
this.createMiniMap(left, top)
this.setView()
this.setView(true)
}
this.isShow = true
}
Expand All @@ -240,6 +240,14 @@ export class MiniMap {
*/
public hide = () => {
if (this.isShow) {
// 隐藏小地图时摧毁实例
destroyTeleportContainer(this.lfMap.graphModel.flowId)
this.lf.off('graph:resize', this.onGraphResize)
this.lfMap.destroy()
// 保证重新创建实例时,小地图中内容偏移正确
this.translateX = 0
this.translateY = 0

this.removeMiniMap()
this.lf.emit('miniMap:close', {})
}
Expand Down Expand Up @@ -677,6 +685,7 @@ export class MiniMap {
},
})
}

destroy() {
destroyTeleportContainer(this.lfMap.graphModel.flowId)
this.lf.off('graph:resize', this.onGraphResize)
Expand Down