From 06b0b20adf845c483b8415fb97117102faf20fe5 Mon Sep 17 00:00:00 2001 From: Jorylee <1747358809@qq.com> Date: Fri, 24 Jan 2025 18:52:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=BC=A0=E6=A0=87=E5=B7=A6=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E7=82=B9=E5=87=BB=E6=97=B6=E7=A7=BB=E9=99=A4=E6=89=80?= =?UTF-8?q?=E6=9C=89=20input=20=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 通过获取当前焦点元素并调用其 blur 方法来实现焦点移除 --- src/core/service/controller/Controller.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/service/controller/Controller.tsx b/src/core/service/controller/Controller.tsx index 89582b41..73e33450 100644 --- a/src/core/service/controller/Controller.tsx +++ b/src/core/service/controller/Controller.tsx @@ -177,6 +177,14 @@ export namespace Controller { const pressWorldLocation = Renderer.transformView2World(new Vector(x, y)); // 获取左右中键 lastMousePressLocation[button] = pressWorldLocation; + + // 左右键按下时移除所有input焦点 + if (button === 0 || button === 2) { + const activeElement = document.activeElement as HTMLElement; + if (activeElement && activeElement.blur) { + activeElement.blur(); + } + } } function handleMouseup(button: number, x: number, y: number) {