diff --git a/index.html b/index.html index 50a0e2d..cb6a4f7 100644 --- a/index.html +++ b/index.html @@ -311,7 +311,7 @@

`null` - List of generated touch events. + List of generated touches. @@ -477,15 +477,16 @@

- A list of {{GamepadTouch}} events generated from all touch surfaces. If the - device does not support touch events, MUST be set to `null`. + A list of {{GamepadTouch}} objects generated from all touch + surfaces. If the device does not support touches, MUST be set to + `null`.

The {{Gamepad/touches}} getter steps are:

    -
  1. If [=this=].{{Gamepad/[[touches]]}} not `null` and not - empty, return [=this=].{{Gamepad/[[touches]]}}. +
  2. If [=this=].{{Gamepad/[[touches]]}} not `null` and not empty, + return [=this=].{{Gamepad/[[touches]]}}.
  3. Otherwise return `null`.
  4. @@ -678,49 +679,39 @@

- To update touches for |gamepad:Gamepad|, run - the following steps: + To update touches for |gamepad:Gamepad|, run the following + steps:

    -
  1. Let |surfaceId:unsigned long| be 0. -
  2. -
  3. Remove any existing events from +
  4. Remove any existing objects from {{Gamepad}}.{{Gamepad/[[touches]]}}.
  5. -
  6. Repeat the following steps for each [=touch surface=] on - |gamepad| in [=touch surface enumeration order=]: +
  7. Repeat the following steps for each touch surface on |gamepad| in + touch surface enumeration order:
      -
    1. Let |surfaceDimensions| be an `null`. +
    2. Let |surfaceId:unsigned long| be the current surface + enumeration index.
    3. If the touch surface exposes maximum surface dimensions in - device units: -
        -
      1. Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[0] to - the maximum X dimension on the [=touch surface=] in device - units. -
      2. -
      3. Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[1] to - the maximum Y dimension on the [=touch surface=] in device - units. -
      4. -
      + device units, then set |touch|.{{GamepadTouch/surfaceDimensions}} + to a {{DOMRect}} with `width` and `height` initialized to the + maximum X and Y dimensions on the touch surface in device units.
    4. -
    5. Repeat the following steps for each [=active touch point=] - reported by the |gamepad| for the current [=touch surface=]. +
    6. Repeat the following steps for each active touch point + reported by the |gamepad| for the current touch surface.
      1. Let |nextTouchId:unsigned long| be the next available touchId for the |gamepad|.
      2. -
      3. Let |touchEvent:GamepadTouch| be a {{GamepadTouch}}. +
      4. Let |touch:GamepadTouch| be a {{GamepadTouch}}.
      5. -
      6. Set |touchEvent|.{{GamepadTouch/surfaceId}} to be - |surfaceId|. +
      7. Set |touch|.{{GamepadTouch/surfaceId}} to be |surfaceId|.
      8. -
      9. If the touch data is part of an existing [=active touch - point=] tracked by the user agent: +
      10. If the touch data is part of an existing active touch + point tracked by the user agent:
          -
        1. Set |touchEvent|.{{GamepadTouch/touchId}} to the - touchId of the [=active touch point=]. +
        2. Set |touch|.{{GamepadTouch/touchId}} to the touchId + of the active touch point.
        3. Otherwise, set touchId to nextTouchId and increment nextTouchId. @@ -732,48 +723,28 @@

      11. -
      12. Let |position| be a [=new=] {{Float32Array}} with length - 2. +
      13. Let |position| be a [=new=] {{DOMPoint}} with `x` + initialized to device X coordinate relative to the device + touch surface and normalized to [-1.0,1.0] where -1.0 is the + leftmost coordinate and 1.0 is the rightmost coordinate and + `y` initialized to the device touch surface and normalized to + [-1.0,1.0] where -1.0 is the leftmost coordinate and 1.0 is + the rightmost coordinate.
      14. -
      15. -

        - |position|[0] should be set to the device X coordinate - relative to the device touch surface and normalized - to [-1.0,1.0] where -1.0 is the leftmost coordinate and - 1.0 is the rightmost coordinate. -

        -

        - `position[0] = (2.0 * touchData.x / surfaceDimensions[0]) - - 1` -

        -
      16. -
      17. -

        - |position|[1] should be set to the device Y coordinate - relative to the device touch surface and normalized - to [-1.0,1.0] where -1.0 is the topmost coordinate and - 1.0 is the bottommost coordinate. -

        -

        - `position[1] = (2.0 * touchData.y / surfaceDimensions[1]) - - 1` -

        +

        + `x = (2.0 * touchData.x / surfaceDimensions.width) - 1` +

        +

        + `y = (2.0 * touchData.y / surfaceDimensions.height) - 1` +

        +
      18. Add |touch| to {{Gamepad}}.{{Gamepad/[[touches]]}}.
    7. -
    8. Set |touchEvent|.{{GamepadTouch/position}} to be - |position:Float32Array|. -
    9. -
    10. Add |touchEvent| to {{Gamepad}}.{{Gamepad/[[touches]]}}. -
  8. -
  9. Increment |surfaceId| -
  10. -
  11. Increment |surfaceId| -
@@ -807,8 +778,8 @@

  • Initialize |gamepad|.{{Gamepad/[[buttons]]}} to the result of [=initializing buttons=] for |gamepad|.
  • -
  • Initialize |gamepad|.{{Gamepad/[[touches]]}} to the - result of [=initializing touches=] for |gamepad|. +
  • Initialize |gamepad|.{{Gamepad/[[touches]]}} to the result of + [=initializing touches=] for |gamepad|.
  • Initialize |gamepad|.{{Gamepad/[[vibrationActuator]]}} following the steps of [=constructing a GamepadHapticActuator=] @@ -1019,15 +990,15 @@

  • - To initialize - touches for a gamepad, run the following steps: + To initialize touches for a + gamepad, run the following steps:

    1. If the |gamepad| has touch surfaces, initialize |gamepad|'s {{Gamepad/touches}} to an empty [=list=].
    2. -
    3. Otherwise, initialize |gamepad|'s {{Gamepad/touches}} - null. +
    4. Otherwise, initialize |gamepad|'s {{Gamepad/touches}} + null.

    @@ -1212,18 +1183,19 @@

    position
    - x, y coordinates of the touch event. Range of each coordinate is - normalized to [-1.0, 1.0]. Along the x-axis, -1.0 references the + A {{DOMPoint}} which holds the x, y coordinates of the touch event. + The z and w value are currently unused. The range of each coordinate + is normalized to [-1.0, 1.0]. Along the x-axis, -1.0 references the leftmost coordinate and 1.0 references the rightmost coordinate. Along the y-axis, -1.0 references the topmost coordinate and 1.0 - references the bottommost coordinate. MUST be a two-element array. + references the bottommost coordinate.
    surfaceDimensions
    - Width and height of the touch surface in integer units. When not - null, MUST be a two-element array. + A {{DOMRect}} initialized with the width and height of the touch + surface in integer units. If not available then null.