Re: [w3c/gamepad] Add extended buttons to support trackpad (#191) (PR #196)

@nondebug commented on this pull request.



> @@ -952,6 +953,17 @@ <h2>
             .. 1.0]
           </td>
         </tr>
+        <tr>
+          <td>
+            <dfn data-dfn-for="GamepadButton">[[\type]]</dfn>

I think the internal slot [[type]] isn't needed and can be removed.

Normally we use internal slots for read-only attributes that the user agent needs to modify. We expect a GamepadButton created with a button type will always have that type, so we don't need a way to modify it.

On index.html:

Please add steps to the "initialize buttons" steps to initialize the button type.

https://w3c.github.io/gamepad/#dfn-initializing-buttons

Currently we initialize buttons in two phases. First, determine how many buttons are needed. Then, create all the buttons.

We'll need to remember the button type from the first phase so we can initialize the GamepadButton in the second phase. We also need to handle some special cases:

A GamepadButton may be created without a corresponding button input on the gamepad. (For instance, a gamepad may not have all the Standard Gamepad buttons; the button array entry for a missing button will still have a GamepadButton object but its value should never change.) We can initialize GamepadButton.type to null to represent this case.

A gamepad may have buttons that don't have a canonical button type. We should create a special GamepadButtonType enum value to signal that the button exists but doesn't have a canonical name yet.

> +          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>

sgtm, let's remove the table from this PR and follow up with the wiki page.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/196#pullrequestreview-1995406851
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/gamepad/pull/196/review/1995406851@github.com>

Received on Thursday, 11 April 2024 22:48:12 UTC