From 830029e757b7e8c67b9ce77583e7dc0e300ed4f1 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 26 Jan 2026 12:28:02 +0800
Subject: [PATCH] feat: 地图右键bug
---
applications/task-work-order/src/components/map-container/common-cesium-map.vue | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/applications/task-work-order/src/components/map-container/common-cesium-map.vue b/applications/task-work-order/src/components/map-container/common-cesium-map.vue
index f7773f7..47d6ad1 100644
--- a/applications/task-work-order/src/components/map-container/common-cesium-map.vue
+++ b/applications/task-work-order/src/components/map-container/common-cesium-map.vue
@@ -66,6 +66,22 @@
let initialized = false
let removeCameraListener = null
+
+const preventDefault = event => {
+ event.preventDefault()
+ return
+}
+
+const cesiumContextMenu = (isAdd = true) => {
+ let cesium = document.getElementById(mapId)
+ if (!cesium) return
+ if (isAdd) {
+ cesium.addEventListener('contextmenu', preventDefault)
+ } else {
+ cesium.removeEventListener('contextmenu', preventDefault)
+ }
+}
+
const initMap = async () => {
if (initialized) return
initialized = true
@@ -77,6 +93,7 @@
boundary: props.boundary,
contour: props.contour,
})
+ cesiumContextMenu(true)
viewer.value = viewInstance.value.getViewer()
if (props.showAdminBoundary) {
adminBoundarySources = await loadJaAdminBoundary(viewer.value, {
@@ -118,6 +135,7 @@
if (removeCameraListener) removeCameraListener()
removeJaAdminBoundary(viewer.value, adminBoundarySources)
viewInstance.value?.viewerDestroy?.()
+ cesiumContextMenu(false)
})
const getMap = () => ({ viewer: viewer.value, publicCesium: viewInstance.value })
--
Gitblit v1.9.3