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

@nondebug commented on this pull request.



> @@ -820,8 +820,13 @@ <h3>
           <li>[=list/For each=] |rawInputIndex:long| of [=the range=] from 0 to
           |inputCount| − 1:
             <ol>
-              <li>If the the gamepad button at index |rawInputIndex|
-              [=represents a Standard Gamepad button=]:
+              <li>Let |button| be the button at index |rawInputIndex|.

Assigning the button to a variable |button| seems awkward. |button| doesn't have a defined type, it's intended to represent a specific physical button under some device-defined button ordering. Let's reword this to avoid assigning it to anything.

```
<li>Let |type| be the result of determining if the button at index |rawInputIndex|
[=represents a Standard Gamepad button=] or...
</li>
```

> @@ -878,8 +883,14 @@ <h3>
           <li>Initialize |buttons| to be an empty [=list=].
           </li>
           <li>[=list/For each=] |buttonIndex:long| of [=the range=] from 0 to
-          |buttonsSize| − 1, [=list/append=] a [=new=] {{GamepadButton}} to
-          |buttons|.
+          |buttonsSize| − 1:
+            <ol>
+              <li>Let |button:GamepadButton| be a [=new=] {{GamepadButton}} with its
+              {{GamepadButton/type}} attribute initialized to |type|.

We're initializing button.type but the remaining GamepadButton attributes are left uninitialized. Let's specify that button.value is initialized to zero and button.pressed and button.touched are initialized to false.

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

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

Received on Thursday, 13 June 2024 22:44:55 UTC