From 681d2985d66bea03370387aea85732c471e4780b Mon Sep 17 00:00:00 2001 From: e7d Date: Thu, 26 Nov 2020 14:26:19 +0100 Subject: [PATCH] add rumble conffirmation on selection --- js/gamepad.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/gamepad.js b/js/gamepad.js index 9f62b33..9c5a03e 100644 --- a/js/gamepad.js +++ b/js/gamepad.js @@ -399,6 +399,20 @@ class Gamepad { // if one of its button is pressed, activate this gamepad if (button.pressed) { this.map(gamepad.index); + + // confirm mapping with a vibration when available + if (gamepad.vibrationActuator) { + gamepad.vibrationActuator.playEffect( + gamepad.vibrationActuator.type, + { + duration: 100, + strongMagnitude: 0.2, + weakMagnitude: 1, + startDelay: 0, + } + ); + } + return; } }