Skip to content

Commit da91c21

Browse files
committed
onblur reset controls
1 parent e1c8150 commit da91c21

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/client/scripts/FirstPersonControls.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ var FirstPersonControls = class FirstPersonControls {
144144
$(".gameOn").click(function () {
145145
_this.setState("game");
146146
});
147+
window.onblur = function () {
148+
Object.keys(_this.kc).forEach(function (el) {
149+
_this.game.socket.emit("move", _this.kc[el], false);
150+
});
151+
};
147152
lockChangeAlert = function () {
148153
if (
149154
document.pointerLockElement === _this.game.canvas ||

0 commit comments

Comments
 (0)