Merge pull request #1824 from thecodingmachine/fix-focus-iframe
This commit is contained in:
@@ -27,14 +27,6 @@ export class Game extends Phaser.Game {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*window.addEventListener('resize', (event) => {
|
|
||||||
// Let's trigger the onResize method of any active scene that is a ResizableScene
|
|
||||||
for (const scene of this.scene.getScenes(true)) {
|
|
||||||
if (scene instanceof ResizableScene) {
|
|
||||||
scene.onResize(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public step(time: number, delta: number) {
|
public step(time: number, delta: number) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class ActiveEventList {
|
|||||||
anyExcept(...exceptions: UserInputEvent[]): boolean {
|
anyExcept(...exceptions: UserInputEvent[]): boolean {
|
||||||
const userInputEvents = Array.from(this.eventMap);
|
const userInputEvents = Array.from(this.eventMap);
|
||||||
for (const event of userInputEvents) {
|
for (const event of userInputEvents) {
|
||||||
if (event[1] && !exceptions.includes(event[0])) {
|
if (event[ 1 ] && !exceptions.includes(event[ 0 ])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ export class UserInputManager {
|
|||||||
this.joystickForceAccuY = this.joystick?.forceY ? this.joystickForceAccuY : 0;
|
this.joystickForceAccuY = this.joystick?.forceY ? this.joystickForceAccuY : 0;
|
||||||
const cursorKeys = this.joystick?.createCursorKeys();
|
const cursorKeys = this.joystick?.createCursorKeys();
|
||||||
for (const name in cursorKeys) {
|
for (const name in cursorKeys) {
|
||||||
const key = cursorKeys[name as Direction];
|
const key = cursorKeys[ name as Direction ];
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "up":
|
case "up":
|
||||||
this.joystickEvents.set(UserInputEvent.MoveUp, key.isDown);
|
this.joystickEvents.set(UserInputEvent.MoveUp, key.isDown);
|
||||||
@@ -255,6 +255,11 @@ export class UserInputManager {
|
|||||||
(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => {
|
(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => {
|
||||||
this.joystick?.hide();
|
this.joystick?.hide();
|
||||||
this.userInputHandler.handlePointerUpEvent(pointer, gameObjects);
|
this.userInputHandler.handlePointerUpEvent(pointer, gameObjects);
|
||||||
|
|
||||||
|
// Disable focus on iframe (need by Firefox)
|
||||||
|
if (pointer.downElement.nodeName === "CANVAS" && document.activeElement instanceof HTMLIFrameElement) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user