mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Fix stuck moving when window looses focus. Fixes: #408
This commit is contained in:
parent
0f7fd4ccd4
commit
4fc6d7f889
@ -66,11 +66,13 @@ export class KeyHeightControls {
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
window.addEventListener("keyup", this.onKeyUp);
|
||||
window.addEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
stop() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
window.removeEventListener("keyup", this.onKeyUp);
|
||||
window.removeEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,4 +122,9 @@ export class KeyHeightControls {
|
||||
}
|
||||
}
|
||||
|
||||
onStop = evt => {
|
||||
this.up = false;
|
||||
this.down = false;
|
||||
}
|
||||
|
||||
}
|
@ -78,11 +78,13 @@ export class KeyMoveControls {
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
window.addEventListener("keyup", this.onKeyUp);
|
||||
window.addEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
stop() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
window.removeEventListener("keyup", this.onKeyUp);
|
||||
window.removeEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,4 +154,11 @@ export class KeyMoveControls {
|
||||
}
|
||||
}
|
||||
|
||||
onStop = evt => {
|
||||
this.up = false;
|
||||
this.down = false;
|
||||
this.left = false;
|
||||
this.right = false;
|
||||
}
|
||||
|
||||
}
|
@ -67,11 +67,13 @@ export class KeyAngleControls {
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
window.addEventListener("keyup", this.onKeyUp);
|
||||
window.addEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
stop() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
window.removeEventListener("keyup", this.onKeyUp);
|
||||
window.removeEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,4 +123,9 @@ export class KeyAngleControls {
|
||||
}
|
||||
}
|
||||
|
||||
onStop = evt => {
|
||||
this.up = false;
|
||||
this.down = false;
|
||||
}
|
||||
|
||||
}
|
@ -78,11 +78,13 @@ export class KeyMoveControls {
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
window.addEventListener("keyup", this.onKeyUp);
|
||||
window.addEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
stop() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
window.removeEventListener("keyup", this.onKeyUp);
|
||||
window.removeEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,4 +154,11 @@ export class KeyMoveControls {
|
||||
}
|
||||
}
|
||||
|
||||
onStop = evt => {
|
||||
this.up = false;
|
||||
this.down = false;
|
||||
this.left = false;
|
||||
this.right = false;
|
||||
}
|
||||
|
||||
}
|
@ -67,11 +67,13 @@ export class KeyRotateControls {
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
window.addEventListener("keyup", this.onKeyUp);
|
||||
window.addEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
stop() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
window.removeEventListener("keyup", this.onKeyUp);
|
||||
window.removeEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,4 +123,9 @@ export class KeyRotateControls {
|
||||
}
|
||||
}
|
||||
|
||||
onStop = evt => {
|
||||
this.left = false;
|
||||
this.right = false;
|
||||
}
|
||||
|
||||
}
|
@ -65,11 +65,13 @@ export class KeyZoomControls {
|
||||
|
||||
window.addEventListener("keydown", this.onKeyDown);
|
||||
window.addEventListener("keyup", this.onKeyUp);
|
||||
window.addEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
stop() {
|
||||
window.removeEventListener("keydown", this.onKeyDown);
|
||||
window.removeEventListener("keyup", this.onKeyUp);
|
||||
window.removeEventListener("blur", this.onStop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,4 +121,9 @@ export class KeyZoomControls {
|
||||
}
|
||||
}
|
||||
|
||||
onStop = evt => {
|
||||
this.in = false;
|
||||
this.out = false;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user