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({
146146 this . _ec . setOption ( this . _echartsOptions ) ;
147147 } ,
148148
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+
149157 _initEchartsContainer : function ( ) {
150158 var size = this . _map . getSize ( ) ;
151159 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({
6767 */
6868 onRemove : function ( map ) {
6969 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);
7575 } ,
7676
7777 /**
Original file line number Diff line number Diff line change @@ -30,9 +30,12 @@ export default class MapVRenderer extends BaseLayer {
3030 this . canvasLayer = layer ;
3131 this . clickEvent = this . clickEvent . bind ( this ) ;
3232 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 ) ;
3639 this . bindEvent ( ) ;
3740 }
3841
@@ -72,6 +75,9 @@ export default class MapVRenderer extends BaseLayer {
7275 map . on ( 'mousemove' , this . mousemoveEvent ) ;
7376 }
7477 }
78+ this . map . off ( 'movestart' , this . _moveStartEvent ) ;
79+ this . map . off ( 'moveend' , this . _moveEndEvent ) ;
80+ this . map . off ( 'zoomstart' , this . _zoomStartEvent ) ;
7581 }
7682
7783 /**
You can’t perform that action at this time.
0 commit comments