Quellcode durchsuchen

fix: 自适应地图显示东莞市范围

lxf vor 2 Wochen
Ursprung
Commit
b1e5936c03
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. 3 3
      src/views/warningHome/map/boundaryLayer.js

+ 3 - 3
src/views/warningHome/map/boundaryLayer.js

@@ -47,13 +47,13 @@ class BoundaryLayer {
     }
 
     fitView() {
-        const source = this.boundaryLayer.source.getSource();
+        const source = this.boundaryLayer.layer.getSource();
         if (!source || source.getFeatures().length === 0) {
             return;
         }
-        let extent = this.boundaryLayer.source.getExtent();
+        let extent = source.getExtent();
         // 地图自适应到区域可视范围
-        this.kmap.getView().fit(extent, { duration: 500, padding: [100, 100, 100, 100] });
+        this.kmap.getView().fit(extent, { duration: 500, padding: [120, 100, 80, 100] });
     }
 
     toggleLayer(val) {