From e2cea007489eaa0821f787d51a646853ed246a58 Mon Sep 17 00:00:00 2001
From: YANGDL <114714267@qq.com>
Date: 星期一, 08 三月 2021 17:53:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/components/helpers/BasemapHelper.js | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/components/helpers/BasemapHelper.js b/src/components/helpers/BasemapHelper.js
index 9b29e4e..d17a606 100644
--- a/src/components/helpers/BasemapHelper.js
+++ b/src/components/helpers/BasemapHelper.js
@@ -11,6 +11,7 @@
this.basemapList = []
this.basemapMap = new Map()
this.basemapLayerGroup = this.L.layerGroup().addTo(options.map)
+ this.currentBaseMapCode = null
}
/**
@@ -52,13 +53,23 @@
*/
showBasemap = (code, showAnnotation, isHideOthers = true) => {
const basemap = this.basemapMap.get(code)
+
if (isHideOthers) {
this.basemapLayerGroup.clearLayers()
}
- this.basemapLayerGroup.addLayer(basemap.layer)
- if (showAnnotation) {
- this.basemapLayerGroup.addLayer(basemap.annotation)
- }
+ setTimeout(() => {
+ // const layer = this.basemapLayerGroup.hasLayer(basemap.layer)
+ // if (!layer) {
+ this.basemapLayerGroup.addLayer(basemap.layer)
+ // }
+
+ if (showAnnotation) {
+ // if()
+ this.basemapLayerGroup.addLayer(basemap.annotation)
+ } else {
+ this.basemapLayerGroup.removeLayer(basemap.annotation)
+ }
+ }, 300)
}
/**
--
Gitblit v1.8.0