-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ import { Vector } from '../Math/vector'; | |
import { PointerEvent } from './PointerEvent'; | ||
import { EventEmitter, EventKey, Handler, Subscription } from '../EventEmitter'; | ||
import { PointerEvents } from './PointerEventReceiver'; | ||
import { GlobalCoordinates } from '../Math/global-coordinates'; | ||
import { Engine } from '../Engine'; | ||
|
||
export class PointerAbstraction { | ||
public events = new EventEmitter<PointerEvents>(); | ||
|
@@ -50,6 +52,17 @@ export class PointerAbstraction { | |
this.events.off(eventName, handler); | ||
} | ||
|
||
/** | ||
* Called internally by excalibur to keep pointers up to date | ||
* @internal | ||
* @param pos | ||
Check warning on line 58 in src/engine/Input/PointerAbstraction.ts
|
||
*/ | ||
public _updateWorldPosition(engine: Engine) { | ||
const coord = GlobalCoordinates.fromPagePosition(this.lastPagePos, engine); | ||
this.lastScreenPos = coord.screenPos; | ||
this.lastWorldPos = coord.worldPos; | ||
} | ||
|
||
private _onPointerMove = (ev: PointerEvent): void => { | ||
this.lastPagePos = new Vector(ev.pagePos.x, ev.pagePos.y); | ||
this.lastScreenPos = new Vector(ev.screenPos.x, ev.screenPos.y); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters