shuhao 4 months ago
parent
commit
b08e3a7938
2 changed files with 6 additions and 4 deletions
  1. 1 1
      src/utils/ol-map/Map.js
  2. 5 3
      src/views/authentic/authenticMap.js

+ 1 - 1
src/utils/ol-map/Map.js

@@ -913,7 +913,7 @@ class Map {
 		this.view.fit(bounds) //地图视角切换到矩阵范围
 	}
 	fit(geometryOrExtent,options){
-		this.view.fit(geometryOrExtent,{ duration:500})
+		this.view.fit(geometryOrExtent)
 	}
 	/**
 	 * @description 平面地图像素坐标转经纬度坐标

+ 5 - 3
src/views/authentic/authenticMap.js

@@ -233,9 +233,6 @@ class AuthenticMap {
       }
     });
     mapData.selectPointArr = arr;
-    if(arr.length>0){
-        this.fit([arr[0].get('featureWkt')])
-    }
   }
   //no全选
   allUnSelect(){
@@ -387,6 +384,7 @@ class AuthenticMap {
   search(form){
     const points = this.kmap.getLayerFeatures();
     let arr = []
+    let geomWkt = []
     points.forEach((feature) => {
       let condition = []
       if(form.address != ''){
@@ -421,10 +419,14 @@ class AuthenticMap {
       }
       if(b){
         arr.push(feature.get("id"))
+        geomWkt.push(new WKT().writeGeometry(feature.getGeometry()))
       }
     });
     this.allUnSelect()
     this.allSelect(arr)
+    if(geomWkt.length>0){
+      this.fit(geomWkt)
+    }
   }
 }