* 帧末清理临时状态 * Clear temporary state at end of frame * @internal
()
| 433 | * @internal |
| 434 | */ |
| 435 | endFrame(): void { |
| 436 | // 清理键盘帧状态 | Clear keyboard frame state |
| 437 | for (const code of this._keysJustPressed) { |
| 438 | const state = this._keyStates.get(code); |
| 439 | if (state) { |
| 440 | state.justPressed = false; |
| 441 | } |
| 442 | } |
| 443 | this._keysJustPressed.clear(); |
| 444 | |
| 445 | for (const code of this._keysJustReleased) { |
| 446 | const state = this._keyStates.get(code); |
| 447 | if (state) { |
| 448 | state.justReleased = false; |
| 449 | } |
| 450 | } |
| 451 | this._keysJustReleased.clear(); |
| 452 | |
| 453 | // 清理鼠标帧状态 | Clear mouse frame state |
| 454 | for (const button of this._mouseButtonsJustPressed) { |
| 455 | const state = this._mouseButtonStates.get(button); |
| 456 | if (state) { |
| 457 | state.justPressed = false; |
| 458 | } |
| 459 | } |
| 460 | this._mouseButtonsJustPressed.clear(); |
| 461 | |
| 462 | for (const button of this._mouseButtonsJustReleased) { |
| 463 | const state = this._mouseButtonStates.get(button); |
| 464 | if (state) { |
| 465 | state.justReleased = false; |
| 466 | } |
| 467 | } |
| 468 | this._mouseButtonsJustReleased.clear(); |
| 469 | |
| 470 | // 清理鼠标移动和滚动 | Clear mouse movement and scroll |
| 471 | this._mouseMovement.x = 0; |
| 472 | this._mouseMovement.y = 0; |
| 473 | this._scrollDelta.x = 0; |
| 474 | this._scrollDelta.y = 0; |
| 475 | |
| 476 | // 清理触摸帧状态 | Clear touch frame state |
| 477 | this._touchesJustStarted.clear(); |
| 478 | this._touchesJustEnded.clear(); |
| 479 | } |
| 480 | |
| 481 | /** |
| 482 | * 重置所有输入状态 |