Skip to content

Commit f3fb764

Browse files
fix webmap 清除图层时清除了不属于当前viewmodel 的 source review by luox
1 parent 42e53da commit f3fb764

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

dist/mapboxgl/include-mapboxgl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
inputScript(libsurl + '/vue-cesium/2.1.4/index.umd.min.js');
212212
}
213213
if (inArray(includes, 'snap')) {
214-
inputScript(libsurl + '/mapbox-gl-draw-snap-mode/0.2.1/mapbox-gl-draw-snap-mode.min.js');
214+
inputScript(libsurl + '/mapbox-gl-draw-snap-mode/0.2.0/mapbox-gl-draw-snap-mode.min.js');
215215
}
216216
if (inArray(includes, 'ugcwasm')) {
217217
inputScript(libsurl + '/ugcwasm/1.0.0/UGCWasmAll.js');

src/common/mapping/MapBase.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ export function createMapClassExtending(SuperClass = class {}) {
6767
const sourceList = [];
6868
for (const item of layers) {
6969
item.renderLayers.forEach((layerId) => {
70-
if (this.map.getLayer(layerId)) {
70+
const layer = this.map.getLayer(layerId);
71+
if (layer) {
7172
this.map.removeLayer(layerId);
72-
if (!item.l7Layer && this.map.getSource(layerId)) {
73-
sourceList.push(layerId);
73+
if (!item.l7Layer && layer.source && typeof layer.source === 'string') {
74+
sourceList.push(layer.source);
7475
}
7576
}
7677
});

0 commit comments

Comments
 (0)