MCPcopy Create free account
hub / github.com/esengine/esengine / endFrame

Method endFrame

packages/engine-core/src/Input/InputManager.ts:435–479  ·  view source on GitHub ↗

* 帧末清理临时状态 * Clear temporary state at end of frame * @internal

()

Source from the content-addressed store, hash-verified

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 * 重置所有输入状态

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected