From 86489c326cbd3acc0ab549580b35d34372f0d1ec Mon Sep 17 00:00:00 2001 From: xudan Date: Mon, 29 Sep 2025 09:12:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E7=BB=84=E5=92=8C=E6=A0=87=E7=AD=BE=E7=BB=84=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A6=81=E7=94=A8=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BA=A4=E4=BA=92=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/robot-groups.vue | 5 +++++ src/components/robot-labels.vue | 5 +++++ src/pages/scene-editor.vue | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/components/robot-groups.vue b/src/components/robot-groups.vue index 8efbf8a..88d2916 100644 --- a/src/components/robot-groups.vue +++ b/src/components/robot-groups.vue @@ -17,6 +17,7 @@ type Props = { showGroupEdit?: boolean; editable?: boolean; current?: string; + disableContextMenu?: boolean; }; const props = defineProps(); const editor = inject(props.token)!; @@ -87,6 +88,10 @@ const selectRobot = (id: RobotInfo['id'], checked: boolean) => { // 处理机器人右键点击 const handleRobotRightClick = (event: MouseEvent, robot: RobotInfo) => { + if (props.disableContextMenu) { + event.preventDefault(); + return; + } // 为事件目标添加机器人标识 if (event.target && event.target instanceof HTMLElement) { event.target.setAttribute('data-robot-id', robot.id); diff --git a/src/components/robot-labels.vue b/src/components/robot-labels.vue index 423dd18..7452197 100644 --- a/src/components/robot-labels.vue +++ b/src/components/robot-labels.vue @@ -17,6 +17,7 @@ type Props = { showLabelEdit?: boolean; editable?: boolean; current?: string; + disableContextMenu?: boolean; }; const props = defineProps(); const editor = inject(props.token)!; @@ -86,6 +87,10 @@ const selectRobot = (id: RobotInfo['id'], checked: boolean) => { // 处理机器人右键点击 const handleRobotRightClick = (event: MouseEvent, robot: RobotInfo) => { + if (props.disableContextMenu) { + event.preventDefault(); + return; + } // 为事件目标添加机器人标识 if (event.target && event.target instanceof HTMLElement) { event.target.setAttribute('data-robot-id', robot.id); diff --git a/src/pages/scene-editor.vue b/src/pages/scene-editor.vue index 7643718..84e4ecc 100644 --- a/src/pages/scene-editor.vue +++ b/src/pages/scene-editor.vue @@ -354,6 +354,7 @@ const handleAutoCreateStorageCancel = () => { :current="current?.id" @change="selectRobot" show-group-edit + :disable-context-menu="true" /> @@ -364,6 +365,7 @@ const handleAutoCreateStorageCancel = () => { :editable="editable" :current="current?.id" @change="selectRobot" + :disable-context-menu="true" />