From 611705b6b779e382e663b596934052679b621744 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Sat, 23 Dec 2023 13:43:37 +0800
Subject: [PATCH] 图标修改

---
 src/views/check/components/OlMapBox.vue |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/views/check/components/OlMapBox.vue b/src/views/check/components/OlMapBox.vue
index add9d6b..47e6f27 100644
--- a/src/views/check/components/OlMapBox.vue
+++ b/src/views/check/components/OlMapBox.vue
@@ -149,6 +149,11 @@
                 )
             })
 
+            mapView.getView().on('change:resolution', function () {
+                console.log('mapView地图缩放事件')
+                // that.$emit('getlivePersonLocationList')
+            })
+
             that.baseInitLayer(that.mapType)
         })
     },
@@ -278,7 +283,9 @@
                         color: color
                     }),
                     padding: [2, 5, 2, 5],
-                    stroke: new Stroke({ color: '#00000000', width: 1 })
+                    stroke: new Stroke({ color: '#00000000', width: 1 }),
+                    offsetX: -60,
+                    offsetY: -60
                 })
             }
 
@@ -384,7 +391,7 @@
                     layersObjcect[layerName] = new VectorLayer({
                         // 图标图层
                         zIndex: 24,
-                        minZoom: 12,
+                        // minZoom: 12,
                         source: new VectorSource(),
                     })
                 }
@@ -397,17 +404,17 @@
                     item,
                     lng: item.lng,
                     lat: item.lat,
+                    text: item.text,
                     url: imgUrl,
                     event: incident
                 }))
-                mapView.getView().animate({ // 只设置需要的属性即可
-                    center: [item.lng, item.lat], // 中心点
-                    zoom: 18, // 缩放级别
-                    rotation: undefined, // 缩放完成view视图旋转弧度
-                    duration: 1000 // 缩放持续时间,默认不需要设置
-                })
             })
-
+            mapView.getView().animate({ // 只设置需要的属性即可
+                center: [positionData[0].lng, positionData[0].lat], // 中心点
+                zoom: 18, // 缩放级别
+                rotation: undefined, // 缩放完成view视图旋转弧度
+                // duration: 1000 // 缩放持续时间,默认不需要设置
+            })
         },
 
         // 生成地图弹窗

--
Gitblit v1.9.3