Re: [w3c/gamepad] Fold touchEvents from extensions.html into index.html (PR #198)

@nondebug commented on this pull request.



> @@ -302,6 +303,17 @@ <h2>
             A [=list=] containing the maximum logical value for each button
           </td>
         </tr>
+        <tr>
+          <td>
+            <dfn data-dfn-for="Gamepad">[[\surfaces]]</dfn>
+          </td>
+          <td>
+            `null`
+          </td>
+          <td>
+            List of touch surfaces available.

nit: types

```
A [=list=] of {{GamepadSurface}} touch surfaces available.
```

> @@ -460,6 +472,26 @@ <h2>
             </li>
           </ol>
         </dd>
+        <dt>
+          <dfn>surfaces</dfn>
+        </dt>
+        <dd>
+          <p>
+            A list of {{GamepadSurface}} surfaces available on the {{Gamepad}}.
+            If the device does not support touch surfaces, MUST be set to
+            `null`.
+          </p>
+          <p>
+            The {{Gamepad/surfaces}} getter steps are:
+          </p>
+          <ol>
+            <li>If [=this=].{{Gamepad/[[surfaces]]}} not `null` and not empty,

Returning from [[surfaces]] would make Gamepad behave like a live object and we want it to behave like a snapshot. Instead of returning [[surfaces]], we should copy [[surfaces]] to Gamepad.surfaces when the Gamepad is created and return the snapshot copy.

> @@ -302,6 +303,18 @@ <h2>
             A [=list=] containing the maximum logical value for each button
           </td>
         </tr>
+        <tr>
+          <td>
+            <dfn data-dfn-for="Gamepad">[[\touches]]</dfn>
+          </td>
+          <td>
+            Initialize to an [=list/empty=] [=list=]

[=list/empty=] clears the list, I think we want [=list/is empty=]

> @@ -460,6 +473,23 @@ <h2>
             </li>
           </ol>
         </dd>
+        <dt>
+          <dfn>touches</dfn>

<dfn>touches attribute</dfn>

> @@ -644,6 +678,106 @@ <h3>
             </ol>
           </li>
         </ol>
+        <p>
+          When the user agent modifies the list of |active touch points| for a
+          touch surface by adding touch points, removing touch points, or
+          updating the values of existing touch points, <dfn>update
+          touchEvents</dfn> by running the following steps:
+        </p>
+        <ol class="algorithm">
+          <li>Let |surfaceId:unsigned long| be 0.
+          </li>
+          <li>Remove any existing events from

Right, this should fill [[surfaces]].

> +              </li>
+              <li>If the touch surface exposes maximum surface dimensions in
+              device units:
+                <ol>
+                  <li>Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[0] to
+                  the maximum X dimension on the touch surface in device units.
+                  </li>
+                  <li>Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[1] to
+                  the maximum Y dimension on the touch surface in device units.
+                  </li>
+                </ol>
+              </li>
+              <li>Repeat the following steps for each active touch point
+              reported by the |gamepad| for the current touch surface.
+                <ol>
+                  <li>Let |nextTouchId:unsigned long| be the next available

nextTouchId should be an internal slot on Gamepad

> @@ -460,6 +473,23 @@ <h2>
             </li>
           </ol>
         </dd>
+        <dt>
+          <dfn>touches</dfn>
+        </dt>
+        <dd>
+          <p>
+            A [=list=] of {{GamepadTouch}} objects generated from all touch
+            surfaces.
+          </p>
+          <p>
+            The {{Gamepad/touches}} getter steps are:
+          </p>
+          <ol>
+            <li>Return the [=list=] of the {{Gamepad/[[touches]]}} the internal

I think this can be:

Return [=this=].{{Gamepad/[[touches]]}}.

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

Message ID: <w3c/gamepad/pull/198/review/2334218318@github.com>

Received on Friday, 14 February 2025 00:36:23 UTC