File tree Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,14 @@ export var EchartsLayer = L.Layer.extend({
146
146
this . _ec . setOption ( this . _echartsOptions ) ;
147
147
} ,
148
148
149
+ onRemove : function ( map ) {
150
+ for ( var i in this . _layers ) {
151
+ map . removeLayer ( this . _layers [ i ] ) ;
152
+ }
153
+ // 销毁echarts实例
154
+ this . _ec . dispose ( ) ;
155
+ } ,
156
+
149
157
_initEchartsContainer : function ( ) {
150
158
var size = this . _map . getSize ( ) ;
151
159
var _div = document . createElement ( 'div' ) ;
Original file line number Diff line number Diff line change @@ -67,11 +67,11 @@ export var MapVLayer = L.Layer.extend({
67
67
*/
68
68
onRemove : function ( map ) {
69
69
L . DomUtil . remove ( this . container ) ;
70
- map . off ( {
71
- moveend : this . draw ,
72
- zoomstart : this . _hide ,
73
- zoomend : this . _show
74
- } , this ) ;
70
+ // map.off({
71
+ // moveend: this.draw,
72
+ // zoomstart: this._hide,
73
+ // zoomend: this._show
74
+ // }, this);
75
75
} ,
76
76
77
77
/**
Original file line number Diff line number Diff line change @@ -30,9 +30,12 @@ export default class MapVRenderer extends BaseLayer {
30
30
this . canvasLayer = layer ;
31
31
this . clickEvent = this . clickEvent . bind ( this ) ;
32
32
this . mousemoveEvent = this . mousemoveEvent . bind ( this ) ;
33
- this . map . on ( 'movestart' , this . moveStartEvent . bind ( this ) ) ;
34
- this . map . on ( 'moveend' , this . moveEndEvent . bind ( this ) ) ;
35
- this . map . on ( 'zoomstart' , this . zoomStartEvent . bind ( this ) ) ;
33
+ this . _moveStartEvent = this . moveStartEvent . bind ( this ) ;
34
+ this . _moveEndEvent = this . moveEndEvent . bind ( this ) ;
35
+ this . _zoomstart = this . zoomStartEvent . bind ( this ) ;
36
+ this . map . on ( 'movestart' , this . _moveStartEvent ) ;
37
+ this . map . on ( 'moveend' , this . _moveEndEvent ) ;
38
+ this . map . on ( 'zoomstart' , this . _zoomstart ) ;
36
39
this . bindEvent ( ) ;
37
40
}
38
41
@@ -72,6 +75,9 @@ export default class MapVRenderer extends BaseLayer {
72
75
map . on ( 'mousemove' , this . mousemoveEvent ) ;
73
76
}
74
77
}
78
+ this . map . off ( 'movestart' , this . _moveStartEvent ) ;
79
+ this . map . off ( 'moveend' , this . _moveEndEvent ) ;
80
+ this . map . off ( 'zoomstart' , this . _zoomStartEvent ) ;
75
81
}
76
82
77
83
/**
You can’t perform that action at this time.
0 commit comments