From 5362a88721ffbb3c644ba5955b7b0f45fbc60ca0 Mon Sep 17 00:00:00 2001
From: dj <1042039504@qq.com>
Date: Tue, 16 Sep 2025 22:09:38 +0800
Subject: [PATCH] =?UTF-8?q?feat(tunnel):=20=E6=B7=BB=E5=8A=A0=E7=83=AD?=
=?UTF-8?q?=E7=82=B9=E5=8C=BA=E5=9F=9F=E6=82=AC=E6=B5=AE=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 polygon-demo.vue 中添加了 svg 元素,用于显示热点区域
- 实现了鼠标悬停在热点区域上时显示相关区域的功能
-优化了热点区域的渲染逻辑,提高了交互体验
---
src/views/tunnel/polygon-demo.vue | 49 +++++++++++++++++++++++++++----
1 file changed, 43 insertions(+), 6 deletions(-)
diff --git a/src/views/tunnel/polygon-demo.vue b/src/views/tunnel/polygon-demo.vue
index 386f977..676d741 100644
--- a/src/views/tunnel/polygon-demo.vue
+++ b/src/views/tunnel/polygon-demo.vue
@@ -5,8 +5,16 @@
+
+
+

+
@@ -26,9 +34,9 @@
@@ -345,6 +355,7 @@ const routeList = ref([]);
let socket = reactive("");
let pattern = reactive(new RegExp("[A-Za-z]+"));
let isTunnel = reactive(false);
+let showAarea10 = ref(false);
const coordsList = ref([
{
//厂房
@@ -366,6 +377,7 @@ const coordsList = ref([
coords: '847,74,833,64,819,28,820,79,842,87'
}
])
+
const btnList = ref([
{
route: "/site",
@@ -399,8 +411,6 @@ const roleKey = ref("");
// 测量模式相关变量
const isMeasuring = ref(false);
const measurementPoints = ref([]);
-
-
let token = getToken();
let send = {
type: "ping",
@@ -433,6 +443,29 @@ onMounted(() => {
});
+const pts = [{x:50,y:50},{x:300,y:80}];
+const str = pts.map(p => `${p.x},${p.y}`).join(' ');
+nextTick(()=>{
+
+ // document.getElementById('poly1').setAttribute('points', str);
+
+ const area1 = document.getElementById("area0");
+ // const area2 = document.getElementById("area2");
+
+ area1.addEventListener("mouseenter", e => {
+ console.log("鼠标移动在区域0", e.clientX, e.clientY);
+ showAarea10.value=true
+ });
+ area1.addEventListener("mouseout", e => {
+ console.log("鼠标移动在区域0", e.clientX, e.clientY);
+ showAarea10.value=false
+ });
+
+ // area2.addEventListener("mouseenter", () => {
+ // console.log("鼠标进入区域2");
+ // });
+})
+
function convertCoordsToArray(coordsArray) {
return coordsArray.map(point => `${point.x},${point.y}`).join(',');
}
@@ -847,7 +880,7 @@ const toggleMeasurementMode = () => {
const handleImageClick = (event) => {
// 如果不是测量模式,执行原来的getInfo逻辑
if (!isMeasuring.value) {
- getInfo();
+ // getInfo();
return;
}
@@ -972,6 +1005,10 @@ const clearMeasurementPoints = () => {