diff --git a/index.html b/index.html index 6376806..66a63d8 100644 --- a/index.html +++ b/index.html @@ -656,13 +656,13 @@

  1. Let |gamepad:Gamepad| be a newly created {{Gamepad}} instance:
      -
    1. Initialize |gamepad|'s {{Gamepad/id}} attribute to an +
    2. Initialize |gamepad|.{{Gamepad/id}} to an identification string for the gamepad.
    3. -
    4. Initialize |gamepad|'s {{Gamepad/index}} attribute to the +
    5. Initialize |gamepad|.{{Gamepad/index}} to the result of [=selecting an unused gamepad index=] for |gamepad|.
    6. -
    7. Initialize |gamepad|'s {{Gamepad/mapping}} attribute to the +
    8. Initialize |gamepad|.{{Gamepad/mapping}} to the result of [=selecting a mapping=] for the gamepad device.
    9. Initialize |gamepad|.{{Gamepad/[[connected]]}} to `true`. @@ -1702,17 +1702,70 @@

    10. [=list/For each=] |gamepad:Gamepad| of [=this=].{{Navigator/[[gamepads]]}}:
        -
      1. If |gamepad| is not `null` and - |gamepad|.{{Gamepad/[[exposed]]}} is `false`: +
      2. If |gamepad| is `null` or |gamepad|.{{Gamepad/[[exposed]]}} + is `false`, [=list/append=] `null` to |gamepads|. +
      3. +
      4. Otherwise:
          -
        1. Set |gamepad|.{{Gamepad/[[exposed]]}} to `true`. +
        2. Let |axesCopy| be a new [=list=]. +
        3. +
        4. [=list/For each=] |axis| of + |gamepad|.{{Gamepad/[[axes]]}}, [=list/append=] |axis| to + |axesCopy|. +
        5. +
        6. Let |buttonsCopy| be a new [=list=].
        7. -
        8. Set |gamepad|.{{Gamepad/[[timestamp]]}} to |now|. +
        9. [=list/For each=] |button| of + |gamepad|.{{Gamepad/[[buttons]]}}: +
            +
          1. Let |buttonCopy| be a newly created {{GamepadButton}} + instance: +
              +
            1. Initialize |buttonCopy|.{{GamepadButton/pressed}} + to |button|.{{GamepadButton/pressed}}. +
            2. +
            3. Initialize |buttonCopy|.{{GamepadButton/touched}} + to |button|.{{GamepadButton/touched}}. +
            4. +
            5. Initialize |buttonCopy|.{{GamepadButton/value}} + to |button|.{{GamepadButton/value}}. +
            6. +
            +
          2. +
          3. [=list/Append=] |buttonCopy| to |buttonsCopy|. +
          4. +
          +
        10. +
        11. Let |gamepadCopy:Gamepad| be a newly created {{Gamepad}} + instance: +
            +
          1. Initialize |gamepadCopy|'s {{Gamepad/id}} attribute + to |gamepad|.{{Gamepad/id}}. +
          2. +
          3. Initialize |gamepadCopy|'s {{Gamepad/index}} + attribute to |gamepad|.{{Gamepad/index}}. +
          4. +
          5. Initialize |gamepadCopy|'s {{Gamepad/mapping}} + attribute to |gamepad|.{{Gamepad/mapping}}. +
          6. +
          7. Initialize |gamepadCopy|.{{Gamepad/[[connected]]}} to + |gamepad|.{{Gamepad/[[connected]]}}. +
          8. +
          9. Initialize |gamepadCopy|.{{Gamepad/[[timestamp]]}} to + |gamepad|.{{Gamepad/[[timestamp]]}}. +
          10. +
          11. Initialize |gamepadCopy|.{{Gamepad/[[axes]]}} to + |axesCopy|. +
          12. +
          13. Initialize |gamepadCopy|.{{Gamepad/[[buttons]]}} to + |buttonsCopy]. +
          14. +
          +
        12. +
        13. [=list/Append=] |gamepadCopy| to |gamepads|.
      5. -
      6. [=list/Append=] |gamepad| to |gamepads|. -
    11. Return |gamepads|.