From 5d56362848d9f34dabfb728afdf59ca49161097e Mon Sep 17 00:00:00 2001 From: xudan Date: Mon, 15 Sep 2025 17:44:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=AD=E6=B7=BB=E5=8A=A0=20Pen=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AF=BC=E5=85=A5=EF=BC=8C=E4=BC=98=E5=8C=96=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=9C=8D=E5=8A=A1=E4=B8=AD=E7=9A=84=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E9=80=BB=E8=BE=91=E4=BB=A5=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/robot/type.ts | 1 + src/services/editor.service.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apis/robot/type.ts b/src/apis/robot/type.ts index 8387185..e3664cc 100644 --- a/src/apis/robot/type.ts +++ b/src/apis/robot/type.ts @@ -1,4 +1,5 @@ import type { Point } from '@api/map'; +import type { Pen } from '@meta2d/core'; import type { RobotBrand, RobotState, RobotType } from './constant'; diff --git a/src/services/editor.service.ts b/src/services/editor.service.ts index 8f6b86e..6129b0d 100644 --- a/src/services/editor.service.ts +++ b/src/services/editor.service.ts @@ -1283,13 +1283,19 @@ export class EditorService extends Meta2d { const overlayId = `robot-status-${id}`; const exist = this.getPenById(overlayId); - if (!icon || !robotVisible) { + // 机器人不可见:隐藏覆盖图标 + if (!robotVisible) { if (exist) { this.setValue({ id: overlayId, visible: false }, { render, history: false, doEvent: false }); } return; } + // 没有状态图标时:如果之前有覆盖图标,则保持现状,不主动隐藏,避免无新数据推送时图标消失 + if (!icon) { + return; + } + // 如果已存在覆盖图标,更新其属性;否则创建新的 image 图元 if (exist) { this.setValue(