From e733164e1c779b3aef7245936b9daf7875bf791e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 14 Dec 2023 17:12:33 +0800
Subject: [PATCH] 解决屏幕缩放导致鼠标位置不准确的问题,右侧,切换校区后的显示BUG

---
 src/store/modules/openlayerData.js |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/store/modules/openlayerData.js b/src/store/modules/openlayerData.js
index a6bf70a..86a657a 100644
--- a/src/store/modules/openlayerData.js
+++ b/src/store/modules/openlayerData.js
@@ -33,6 +33,7 @@
 import OlSourceOSM from "ol/source/OSM.js";
 import OlLayerTile from "ol/layer/Tile.js";
 import OlMap from "ol/Map.js";
+import { defaults as defaultInteractions } from "ol/interaction";
 
 import XYZ from "ol/source/XYZ";
 
@@ -49,7 +50,27 @@
     },
     openlayers: {
       map2D: new OlMap({
-        layers: [],
+        interactions: defaultInteractions({
+          pinchRotate: false, // 移动端禁止地图旋转
+        }),
+        layers: [
+          /**
+             *  new OlLayerTile({
+                zIndex: 4,
+                title: "影像",
+                source: new XYZ({
+                  url: "http://t4.tianditu.com/DataServer?T=vec_w&tk=b9031f80391e6b65bd1dd80dcde1b097&x={x}&y={y}&l={z}", // 行政区划
+                }),
+              }),
+              new OlLayerTile({
+                zIndex: 5,
+                title: "影像",
+                source: new XYZ({
+                  url: "http://t4.tianditu.com/DataServer?T=cva_w&tk=b9031f80391e6b65bd1dd80dcde1b097&x={x}&y={y}&l={z}", // 行政区划
+                }),
+              }),
+             */
+        ],
         view: new OlView({}),
       }),
       map3D: null,

--
Gitblit v1.9.3