zhiyuan-007 1 yıl önce
ebeveyn
işleme
bbae72272b
2 değiştirilmiş dosya ile 14 ekleme ve 4 silme
  1. 10 1
      src/components/mapJK.vue
  2. 4 3
      src/units/map/AddScaleEvent.js

+ 10 - 1
src/components/mapJK.vue

@@ -292,7 +292,16 @@ export default {
         }
       }
       function showLayersWithScaleEventsReturn(scaleValue){
-        
+        let layer = m_map.layers.find(item => item.id === "WhiteMold");
+        if(scaleValue > 50000){
+          if(layer){
+            layer.visible = false;
+          }
+        }else{
+          if(layer){
+            layer.visible = true;
+          }
+        }
       }
     })
   }

+ 4 - 3
src/units/map/AddScaleEvent.js

@@ -10,12 +10,13 @@ class AddScaleEvent {
    
     addScaleEvent(){
         let currentScale = this.view.scale;  //缓存比例尺信息
+        let throttleService = throttle((newValue) =>{
+            this.callBackFunction(newValue)
+        },500);
         this.scaleHandle = this.view.watch("scale",(newValue) =>{
             if(newValue !== currentScale){
                 currentScale = newValue;
-                throttle(() =>{
-                    this.callBackFunction(newValue)
-                },500)
+                throttleService(newValue);
             }
         })
     }