Skip to content

Commit

Permalink
fix: 鼠标左右键点击时移除所有 input 焦点
Browse files Browse the repository at this point in the history
- 通过获取当前焦点元素并调用其 blur 方法来实现焦点移除
  • Loading branch information
neooier committed Jan 24, 2025
1 parent 251b492 commit 06b0b20
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/service/controller/Controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 06b0b20

Please sign in to comment.