File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/extension/src/components/mini-map Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -198,8 +198,6 @@ export class MiniMap {
198198 this . bounds = boundsInit
199199 this . elementAreaBounds = boundsInit
200200 this . viewPortBounds = boundsInit
201- this . initMiniMap ( )
202- lf . on ( 'graph:resize' , this . onGraphResize )
203201 }
204202
205203 onGraphResize = ( ) => {
@@ -230,8 +228,10 @@ export class MiniMap {
230228 */
231229 public show = ( left ?: number , top ?: number ) => {
232230 if ( ! this . isShow ) {
231+ this . initMiniMap ( )
232+ this . lf . on ( 'graph:resize' , this . onGraphResize )
233233 this . createMiniMap ( left , top )
234- this . setView ( )
234+ this . setView ( true )
235235 }
236236 this . isShow = true
237237 }
@@ -240,6 +240,14 @@ export class MiniMap {
240240 */
241241 public hide = ( ) => {
242242 if ( this . isShow ) {
243+ // 隐藏小地图时摧毁实例
244+ destroyTeleportContainer ( this . lfMap . graphModel . flowId )
245+ this . lf . off ( 'graph:resize' , this . onGraphResize )
246+ this . lfMap . destroy ( )
247+ // 保证重新创建实例时,小地图中内容偏移正确
248+ this . translateX = 0
249+ this . translateY = 0
250+
243251 this . removeMiniMap ( )
244252 this . lf . emit ( 'miniMap:close' , { } )
245253 }
@@ -677,6 +685,7 @@ export class MiniMap {
677685 } ,
678686 } )
679687 }
688+
680689 destroy ( ) {
681690 destroyTeleportContainer ( this . lfMap . graphModel . flowId )
682691 this . lf . off ( 'graph:resize' , this . onGraphResize )
You can’t perform that action at this time.
0 commit comments