Skip to content

Commit 4fe4d61

Browse files
committed
重写imageMapLayer中的onRemove方法
1 parent fcae409 commit 4fe4d61

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

dist/iclient9-leaflet.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58503,6 +58503,20 @@ var ImageMapLayer = exports.ImageMapLayer = _leaflet.Layer.extend({
5850358503
this.update();
5850458504
},
5850558505

58506+
/**
58507+
* @private
58508+
* @function L.supermap.imageMapLayer.prototype.onRemove
58509+
* @description 从地图上移除
58510+
* @param map - {L.map} 待移除的地图对象
58511+
*/
58512+
onRemove: function onRemove(map) {
58513+
// eslint-disable-line no-unused-vars
58514+
if (this._currentImage) {
58515+
this._map.removeLayer(this._currentImage);
58516+
}
58517+
this._map.off('moveend', this.update, this);
58518+
},
58519+
5850658520
/**
5850758521
* @function L.supermap.imageMapLayer.prototype.bringToFront
5850858522
* @description 将当前图层置顶

dist/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/leaflet/mapping/ImageMapLayer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ export var ImageMapLayer = Layer.extend({
9797
this.update();
9898
},
9999

100+
/**
101+
* @private
102+
* @function L.supermap.imageMapLayer.prototype.onRemove
103+
* @description 从地图上移除
104+
* @param map - {L.map} 待移除的地图对象
105+
*/
106+
onRemove: function (map) { // eslint-disable-line no-unused-vars
107+
if (this._currentImage) {
108+
this._map.removeLayer(this._currentImage);
109+
}
110+
this._map.off('moveend', this.update, this);
111+
},
112+
100113
/**
101114
* @function L.supermap.imageMapLayer.prototype.bringToFront
102115
* @description 将当前图层置顶

0 commit comments

Comments
 (0)