Apply suggestions

This commit is contained in:
ferferga 2020-02-28 13:51:41 +01:00
parent 8a200e54af
commit 440675fbee
2 changed files with 6 additions and 19 deletions

View File

@ -145,28 +145,13 @@ define(["inputManager", "layoutManager"], function (inputManager, layoutManager)
}
});
}
// For hiding the mouse while playbackç
require(["components/input/mouseManager"]);
// Gamepad initialization. No script is required if no gamepads are at boot time, saving a bit of resources._10k
// Gamepad initialisation. No script is required if no gamepads are present at init time, saving a bit of resources.
// Whenever the gamepad is connected, we hand all the control of the gamepad to gamepadtokey.js by removing the event handler
function isGamepadConnected() {
var gamepads = navigator.getGamepads();
for (var i = 0, len = gamepads.length; i < len; i++) {
var gamepad = gamepads[i];
if (gamepad) {
return true;
}
}
return false;
}
function attachGamepadScript(e) {
if (isGamepadConnected()) {
console.log("Gamepad connected! Attaching gamepadtokey.js script");
window.removeEventListener("gamepadconnected", attachGamepadScript);
require(["components/input/gamepadtokey"]);
}
console.log("Gamepad connected! Attaching gamepadtokey.js script");
window.removeEventListener("gamepadconnected", attachGamepadScript);
require(["components/input/gamepadtokey"]);
}
// No need to check for gamepads manually at load time, the eventhandler will be fired for that

View File

@ -492,6 +492,7 @@ var AppInfo = {};
require(["keyboardnavigation"], function(keyboardnavigation) {
keyboardnavigation.enable();
});
require(["mouseManager"]);
require(["focusPreventScroll"]);
require(["autoFocuser"], function(autoFocuser) {
autoFocuser.enable();
@ -907,6 +908,7 @@ var AppInfo = {};
define("serverNotifications", [componentsPath + "/serverNotifications"], returnFirstDependency);
define("skinManager", [componentsPath + "/skinManager"], returnFirstDependency);
define("keyboardnavigation", [componentsPath + "/input/keyboardnavigation"], returnFirstDependency);
define("mouseManager", [componentsPath + "/input/mouseManager"], returnFirstDependency);
define("scrollManager", [componentsPath + "/scrollManager"], returnFirstDependency);
define("autoFocuser", [componentsPath + "/autoFocuser"], returnFirstDependency);
define("connectionManager", [], function () {