Fix for Firefox

This commit is contained in:
ferferga 2020-02-29 22:44:08 +01:00
parent 1f7b41e303
commit 3310d5b239

View File

@ -365,7 +365,7 @@ require(['apphost'], function (appHost) {
var gamepads = navigator.getGamepads(); var gamepads = navigator.getGamepads();
for (var i = 0, len = gamepads.length; i < len; i++) { for (var i = 0, len = gamepads.length; i < len; i++) {
var gamepad = gamepads[i]; var gamepad = gamepads[i];
if (gamepad) { if (gamepad && gamepad.connected) {
return true; return true;
} }
} }
@ -388,7 +388,7 @@ require(['apphost'], function (appHost) {
} }
} }
// Event Listeners for any change in gamepads' state. // Event listeners for any change in gamepads' state.
window.addEventListener("gamepaddisconnected", dettachGamepad); window.addEventListener("gamepaddisconnected", dettachGamepad);
window.addEventListener("gamepadconnected", attachGamepad); window.addEventListener("gamepadconnected", attachGamepad);
window.addEventListener("blur", dettachGamepad); window.addEventListener("blur", dettachGamepad);