af-mobile-client-vue3 1.4.91 → 1.4.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -688,7 +688,15 @@ function createPointLayer(config: PointLayerConfig): VectorLayer<VectorSource> {
|
|
|
688
688
|
function addPointLayer(config: PointLayerConfig): VectorLayer<VectorSource> | null {
|
|
689
689
|
if (!map)
|
|
690
690
|
return null
|
|
691
|
-
|
|
691
|
+
if (vectorLayers[config.id]) {
|
|
692
|
+
const oldVectorLayer = vectorLayers[config.id]
|
|
693
|
+
oldVectorLayer.setVisible(false)
|
|
694
|
+
oldVectorLayer.getSource().clear()
|
|
695
|
+
map.removeLayer(oldVectorLayer)
|
|
696
|
+
delete vectorLayers[config.id]
|
|
697
|
+
// 强制刷新地图视图
|
|
698
|
+
map.render()
|
|
699
|
+
}
|
|
692
700
|
const vectorLayer = createPointLayer(config)
|
|
693
701
|
map.addLayer(vectorLayer)
|
|
694
702
|
vectorLayers[config.id] = vectorLayer
|
|
@@ -1035,7 +1043,16 @@ function createPolygonLayer(config: PolygonLayerConfig): VectorLayer<VectorSourc
|
|
|
1035
1043
|
function addPolygonLayer(config: PolygonLayerConfig): VectorLayer<VectorSource> | null {
|
|
1036
1044
|
if (!map)
|
|
1037
1045
|
return null
|
|
1038
|
-
|
|
1046
|
+
// 如果该ID的图层已存在,先移除旧的
|
|
1047
|
+
if (polygonLayers[config.id]) {
|
|
1048
|
+
const oldVectorLayer = polygonLayers[config.id]
|
|
1049
|
+
oldVectorLayer.setVisible(false)
|
|
1050
|
+
oldVectorLayer.getSource().clear()
|
|
1051
|
+
map.removeLayer(oldVectorLayer)
|
|
1052
|
+
delete polygonLayers[config.id]
|
|
1053
|
+
// 强制刷新地图视图
|
|
1054
|
+
map.render()
|
|
1055
|
+
}
|
|
1039
1056
|
const vectorLayer = createPolygonLayer(config)
|
|
1040
1057
|
map.addLayer(vectorLayer)
|
|
1041
1058
|
polygonLayers[config.id] = vectorLayer
|