From 22010dc55f2aab103e4faeb6529abceb998b53f2 Mon Sep 17 00:00:00 2001 From: Sun Shin Date: Tue, 5 Mar 2024 09:18:13 -0800 Subject: [PATCH] Add extended buttons to support trackpad (#191) --- index.html | 580 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 354 insertions(+), 226 deletions(-) diff --git a/index.html b/index.html index 4d4318a..a4e9165 100644 --- a/index.html +++ b/index.html @@ -900,6 +900,7 @@

readonly attribute boolean pressed; readonly attribute boolean touched; readonly attribute double value; + readonly attribute GamepadButtonType type; };

@@ -952,6 +953,17 @@

.. 1.0] + + + [[\type]] + + + `undefined` + + + Indicates the button type the controller is held in. + +
@@ -1018,6 +1030,13 @@

+
+ type attribute +
+
+ An enumeration, {{GamepadButtonType}}, that indicates which button types the controller + is being held in. +

@@ -1718,232 +1737,341 @@

canonical ordering when possible. Devices that are not recognized should still be exposed in their raw form.

-

- There is currently one canonical layout, the Standard - Gamepad. When remapping, the indices in {{Gamepad/axes}} and - {{Gamepad/buttons}} should correspond as closely as possible to the - physical locations in the diagram below. Additionally, - {{Gamepad/mapping}} SHOULD be set to {{GamepadMappingType/"standard"}}. -

-

- The [=Standard Gamepad=] buttons are laid out in a left cluster of four - buttons, a right cluster of four buttons, a center cluster of three - buttons, and a pair of front facing buttons on the left and right side - of the gamepad. The four axes of the "Standard Gamepad" are associated - with a pair of analog sticks, one on the left and one on the right. The - following table describes the buttons/axes and their physical - locations. -

-

- An axis input represents a Standard Gamepad axis if it - reports the input value for a thumbstick axis, the thumbstick is - located in approximately the same location as the corresponding - [=Standard Gamepad=] thumbstick, and the orientation of the axis - (up-down or left-right) matches the orientation of the [=Standard - Gamepad=] axis. If there are multiple axes that represent the same - [=Standard Gamepad=] axis, then the [=user agent=] SHOULD select one to - be the [=Standard Gamepad=] axis and assign a different index to the - other axis. -

-

- A button input represents a Standard Gamepad button if it - reports the input value for a button or trigger, and the button or - trigger is located in approximately the same location as the - corresponding [=Standard Gamepad=] button. -

-

- If an axis or button input represents a [=Standard Gamepad=] axis or - button, then its canonical index is the index of the - corresponding [=Standard Gamepad=] axis or button. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Button/Axis - - Location -
- buttons[0] - - Bottom button in right cluster -
- buttons[1] - - Right button in right cluster -
- buttons[2] - - Left button in right cluster -
- buttons[3] - - Top button in right cluster -
- buttons[4] - - Top left front button -
- buttons[5] - - Top right front button -
- buttons[6] - - Bottom left front button -
- buttons[7] - - Bottom right front button -
- buttons[8] - - Left button in center cluster -
- buttons[9] - - Right button in center cluster -
- buttons[10] - - Left stick pressed button -
- buttons[11] - - Right stick pressed button -
- buttons[12] - - Top button in left cluster -
- buttons[13] - - Bottom button in left cluster -
- buttons[14] - - Left button in left cluster -
- buttons[15] - - Right button in left cluster -
- buttons[16] - - Center button in center cluster -
- axes[0] - - Horizontal axis for left stick (negative left/positive right) -
- axes[1] - - Vertical axis for left stick (negative up/positive down) -
- axes[2] - - Horizontal axis for right stick (negative left/positive right) -
- axes[3] - - Vertical axis for right stick (negative up/positive down) -
-
- -
- Visual representation of a [=Standard Gamepad=] layout. -
-
+
+

+ Standard Mapping +

+

+

+ There is currently one canonical layout, the Standard + Gamepad. When remapping, the indices in {{Gamepad/axes}} and + {{Gamepad/buttons}} should correspond as closely as possible to the + physical locations in the diagram below. Additionally, + {{Gamepad/mapping}} SHOULD be set to {{GamepadMappingType/"standard"}}. +

+

+ The [=Standard Gamepad=] buttons are laid out in a left cluster of four + buttons, a right cluster of four buttons, a center cluster of three + buttons, and a pair of front facing buttons on the left and right side + of the gamepad. The four axes of the "Standard Gamepad" are associated + with a pair of analog sticks, one on the left and one on the right. The + following table describes the buttons/axes and their physical + locations. +

+

+ An axis input represents a Standard Gamepad axis if it + reports the input value for a thumbstick axis, the thumbstick is + located in approximately the same location as the corresponding + [=Standard Gamepad=] thumbstick, and the orientation of the axis + (up-down or left-right) matches the orientation of the [=Standard + Gamepad=] axis. If there are multiple axes that represent the same + [=Standard Gamepad=] axis, then the [=user agent=] SHOULD select one to + be the [=Standard Gamepad=] axis and assign a different index to the + other axis. +

+

+ A button input represents a Standard Gamepad button if it + reports the input value for a button or trigger, and the button or + trigger is located in approximately the same location as the + corresponding [=Standard Gamepad=] button. +

+

+ If an axis or button input represents a [=Standard Gamepad=] axis or + button, then its canonical index is the index of the + corresponding [=Standard Gamepad=] axis or button. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Button/Axis + + Location +
+ buttons[0] + + Bottom button in right cluster +
+ buttons[1] + + Right button in right cluster +
+ buttons[2] + + Left button in right cluster +
+ buttons[3] + + Top button in right cluster +
+ buttons[4] + + Top left front button +
+ buttons[5] + + Top right front button +
+ buttons[6] + + Bottom left front button +
+ buttons[7] + + Bottom right front button +
+ buttons[8] + + Left button in center cluster +
+ buttons[9] + + Right button in center cluster +
+ buttons[10] + + Left stick pressed button +
+ buttons[11] + + Right stick pressed button +
+ buttons[12] + + Top button in left cluster +
+ buttons[13] + + Bottom button in left cluster +
+ buttons[14] + + Left button in left cluster +
+ buttons[15] + + Right button in left cluster +
+ buttons[16] + + Center button in center cluster +
+ axes[0] + + Horizontal axis for left stick (negative left/positive right) +
+ axes[1] + + Vertical axis for left stick (negative up/positive down) +
+ axes[2] + + Horizontal axis for right stick (negative left/positive right) +
+ axes[3] + + Vertical axis for right stick (negative up/positive down) +
+
+ +
+ Visual representation of a [=Standard Gamepad=] layout. +
+
+
+
+

+ Extended Mapping +

+

+ This section introduces an extended gamepad button mapping beyond the Standard Gamepad layout. + These additional buttons are commonly found on certain gamepad models. + The following table defines the extended buttons used by some gamepad models in the following diagrams. + It’s important to note that this list is not exhaustive, and user agents may utilize different + or additional buttons for these or other gamepad models. + Consequently, the number of buttons on the Gamepad is not limited to the standard mapping of 17 buttons. +

+

+ To accommodate extended gamepads, we have incorporated an "extended" mapping enumeration + into the GamepadMappingType. Additionally, we have defined an enumeration for the various + button types in the table, termed "GamepadButtonType", and have expanded the "GamepadButton" + interface to encompass this new button type enumeration. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ButtonsGamepad Models
trackpad/touchpadSony DualSense, DualShock 4
share/captureXbox Wireless Controller Model 1914
+ Nintendo Switch controllers
+ Stadia controller
+
voice assistantGoogle Stadia Controller
+ Amazon Luna Controller
+
homeNvidia Shield Gamepad
squeeze_leftXbox Elite Wireless Controller
+ PlayStation DualSense Edge
squeeze_left_lowerXbox Elite Wireless Controller
squeeze_rightXbox Elite Wireless Controller
+ PlayStation DualSense Edge
squeeze_right_lowerXbox Elite Wireless Controller
+
+

+ GamepadButtonType Enum +

+

+ This enum defines the set of possible button types. +

+
+            enum GamepadButtonType {
+              "",  /* unknown, or not applicable */
+              "trackpad",
+              "share"
+            };
+          
+
+
+ "" (the empty string) +
+
+ The empty string indicates button type is unknown or not applicable. +
+
+ trackpad +
+
+ This button is being assigned to trackpad button. +
+
+ share +
+
+ This button is being assigned to share button. +
+
+
+

Fingerprinting mitigation