handle pointerup event
This commit is contained in:
parent
28543be121
commit
77ee39110f
@ -6,5 +6,6 @@ export interface UserInputHandlerInterface {
|
||||
deltaY: number,
|
||||
deltaZ: number
|
||||
) => void;
|
||||
handlePointerUpEvent: (pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => void;
|
||||
handleSpaceKeyUpEvent: (event: Event) => Event;
|
||||
}
|
||||
|
@ -18,6 +18,11 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
||||
this.gameScene.zoomByFactor(1 - (deltaY / 53) * 0.1);
|
||||
}
|
||||
|
||||
public handlePointerUpEvent(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]): void {
|
||||
const camera = this.gameScene.cameras.main;
|
||||
console.log(`${pointer.x + camera.scrollX}, ${pointer.y + camera.scrollY}`);
|
||||
}
|
||||
|
||||
public handleSpaceKeyUpEvent(event: Event): Event {
|
||||
this.gameScene.activateOutlinedItem();
|
||||
return event;
|
||||
|
@ -226,7 +226,7 @@ export class UserInputManager {
|
||||
|
||||
private bindInputEventHandlers() {
|
||||
this.scene.input.on(
|
||||
"wheel",
|
||||
Phaser.Input.Events.POINTER_WHEEL,
|
||||
(
|
||||
pointer: Phaser.Input.Pointer,
|
||||
gameObjects: Phaser.GameObjects.GameObject[],
|
||||
@ -241,6 +241,13 @@ export class UserInputManager {
|
||||
}
|
||||
);
|
||||
|
||||
this.scene.input.on(
|
||||
Phaser.Input.Events.POINTER_UP,
|
||||
(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => {
|
||||
this.userInputHandler.handlePointerUpEvent(pointer, gameObjects);
|
||||
}
|
||||
);
|
||||
|
||||
this.scene.input.keyboard.on("keyup-SPACE", (event: Event) => {
|
||||
this.userInputHandler.handleSpaceKeyUpEvent(event);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user