From 38fea8139670d34cedea336fbd1ba34fc92bcf02 Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期四, 22 四月 2021 21:34:59 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop
---
src/components/LayerController/service/LayerFactory.js | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js
index 9387933..909038e 100644
--- a/src/components/LayerController/service/LayerFactory.js
+++ b/src/components/LayerController/service/LayerFactory.js
@@ -32,7 +32,13 @@
initMinZoom (config) {
const minZoom = parseInt(config.minZoom)
if (minZoom) {
- this.minZoomLayers[minZoom] = config
+ var configs = this.minZoomLayers[minZoom]
+ if (configs) {
+ configs[configs.length] = config
+ } else {
+ configs = [config]
+ }
+ this.minZoomLayers[minZoom] = configs
}
}
@@ -101,20 +107,23 @@
* @param layerConfig
*/
initEvent (layerConfig) {
- // this.map.on('zoomend ', () => this.toggleByZoom())
+ this.map.on('zoomend ', () => this.toggleByZoom())
}
toggleByZoom () {
const zoom = this.map.getZoom()
for (var k in this.minZoomLayers) {
- const config = this.minZoomLayers[k]
- const checked = config.checked
- console.log(zoom)
- console.log(k)
- if (checked && zoom > k) {
- this.show(config)
- } else if (checked && zoom < k) {
- this.hide(config)
+ const configs = this.minZoomLayers[k]
+ for (var j in configs) {
+ const config = configs[j]
+ const checked = config.checked
+ console.log(zoom)
+ console.log(k)
+ if (checked && zoom > k) {
+ this.show(config)
+ } else if (checked && zoom < k) {
+ this.hide(config)
+ }
}
}
}
--
Gitblit v1.8.0