From e30da21dc4c431cf8257e1e8bc4b108667334137 Mon Sep 17 00:00:00 2001 From: Eugene Serb <46799701+eugene-serb@users.noreply.github.com> Date: Sat, 18 Jun 2022 12:08:13 +0300 Subject: [PATCH] Fixed max patterns. fixed disabling devices, fixed start on device without vibrating actuator, --- js/scripts.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index 9c50b98..2a7228f 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -38,7 +38,7 @@ const __PATTERNS = [ icon: '🙃', pattern: [ { - startDelay: 0, + startDelay: 100, duration: 100, weakMagnitude: 1.0, strongMagnitude: 1.0, @@ -78,7 +78,7 @@ const __PATTERNS = [ icon: '😊', pattern: [ { - startDelay: 0, + startDelay: 100, duration: 250, weakMagnitude: 1.0, strongMagnitude: 1.0, @@ -118,7 +118,7 @@ const __PATTERNS = [ icon: 'ðŸĪŠ', pattern: [ { - startDelay: 0, + startDelay: 100, duration: 500, weakMagnitude: 1.0, strongMagnitude: 1.0, @@ -384,15 +384,17 @@ class VibrationMaster { change = (index) => { if (this.gamepads.length > 0) { this.gamepads.forEach(gamepad => { - this.unselect(); - if (gamepad.index === index && - gamepad.isVibrating === true) { - gamepad.isVibrating = false; - gamepad.reset(); - } else { - gamepad.change(index); - gamepad.vibrate(); - this.select(index); + if (gamepad.canVibrate === true) { + this.unselect(); + if (gamepad.index === index && + gamepad.isVibrating === true) { + gamepad.reset(); + } else { + gamepad.reset() + gamepad.change(index); + gamepad.vibrate(); + this.select(index); + }; }; }); } else { @@ -436,6 +438,7 @@ class VibrationMaster { this.gamepads.splice(index, 1); }; }); + this.unselect(); }); }; };