Skip to content

Commit

Permalink
Add extended buttons to support trackpad (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingri committed Apr 8, 2024
1 parent df03f46 commit eb9c037
Showing 1 changed file with 145 additions and 0 deletions.
145 changes: 145 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ <h2>
readonly attribute boolean pressed;
readonly attribute boolean touched;
readonly attribute double value;
readonly attribute GamepadButtonType type;
};
</pre>
<p>
Expand Down Expand Up @@ -952,6 +953,17 @@ <h2>
.. 1.0]
</td>
</tr>
<tr>
<td>
<dfn data-dfn-for="GamepadButton">[[\type]]</dfn>
</td>
<td>
`undefined`
</td>
<td>
The button type of the controller.
</td>
</tr>
</table>
<dl>
<dt>
Expand Down Expand Up @@ -1018,6 +1030,13 @@ <h2>
</li>
</ol>
</dd>
<dt>
<dfn>type</dfn> attribute
</dt>
<dd>
An enumerated {{GamepadButtonType}} attribute that classifies the current button's type in relation to an
extended mapping.
</dd>
</dl>
</section>
<section data-dfn-for="GamepadMappingType">
Expand Down Expand Up @@ -2023,6 +2042,132 @@ <h2>
Visual representation of a [=Standard Gamepad=] layout.
</figcaption>
</figure>
<section>
<h3>
Extended Mapping
</h3>
<p>
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.
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.
</p>
<p>
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.
</p>
<table class="tg">
<thead>
<tr>
<th scope="col">Buttons</th>
<th scope="col">Gamepad Models</th>
</tr>
</thead>
<tbody>
<tr>
<td>trackpad/touchpad</td>
<td>Sony DualSense, DualShock 4</td>
</tr>
<tr>
<td>share/capture</td>
<td>Nintendo Switch controllers<br>
Stadia controller<br>
Xbox Wireless Controller Model 1914</td>
</tr>
<tr>
<td>voice assistant</td>
<td>Amazon Luna Controller<br>
Google Stadia Controller<br>
Nvidia Shield Controller</td>
</tr>
<tr>
<td>squeeze_left</td>
<td>PlayStation DualSense Edge<br>
Xbox Elite Wireless Controller</td>
</tr>
<tr>
<td>squeeze_left_lower</td>
<td>Xbox Elite Wireless Controller</td>
</tr>
<tr>
<td>squeeze_right</td>
<td>PlayStation DualSense Edge<br>
Xbox Elite Wireless Controller</td>
</tr>
<tr>
<td>squeeze_right_lower</td>
<td>Xbox Elite Wireless Controller</td>
</tr>
</tbody>
</table>
<section>
<h3>
<dfn>GamepadButtonType</dfn> Enum
</h3>
<p>
This enum defines the set of possible button types.
</p>
<pre class="idl">
enum GamepadButtonType {
"squeeze_left",
"squeeze_left_lower",
"squeeze_right",
"squeeze_right_lower",
"share",
"trackpad",
"voice_assist"
};
</pre>
<dl data-dfn-for="GamepadButtonType">
<dt>
<dfn>squeeze_left</dfn>
</dt>
<dd>
This button is being assigned to the left paddle button on the bottom of the gamepad.
</dd>
<dt>
<dfn>squeeze_left_lower</dfn>
</dt>
<dd>
This button is being assigned to the lower left paddle button on the bottom of the gamepad.
</dd>
<dt>
<dfn>squeeze_right</dfn>
</dt>
<dd>
This button is being assigned to the right paddle button on the bottom of the gamepad.
</dd>
<dt>
<dfn>squeeze_right_lower</dfn>
</dt>
<dd>
This button is being assigned to the lower right paddle button on the bottom of the gamepad.
</dd>
<dt>
<dfn>share</dfn>
</dt>
<dd>
This button is being assigned to share or capture button.
</dd>
<dt>
<dfn>trackpad</dfn>
</dt>
<dd>
A trackpad button.
</dd>
<dt>
<dfn>voice_assist</dfn>
</dt>
<dd>
This button is being assigned to voice assistance button.
</dd>
</dl>
</section>
</section>
<section>
<h3>
Fingerprinting mitigation
Expand Down

0 comments on commit eb9c037

Please sign in to comment.