Repository navigation
Spec gamepad input events - #234
gabrielsanbrito wants to merge 3 commits into
Conversation
|
@nondebug @marcoscaceres this is the first draft for the gamepad input events specification. PTAL when you have some time. |
| </li> | ||
| </ol> | ||
| </li> | ||
| <li>Let |oldGamepad:Gamepad| be the state of the device represented |
There was a problem hiding this comment.
"Before the current input changes were applied" is ambigious, please add steps to copy the state from |gamepad| to |oldGamepad| before running the steps to map and normalize buttons and axes.
| </li> | ||
| <li>If |document| is not [=allowed to use=] the [=policy-controlled | ||
| feature=] named "gamepad", then abort these steps. | ||
| </li> |
There was a problem hiding this comment.
Currently the steps to update gamepad state don't check if the document is fully active before firing an event. We should update the steps to abort on not-fully-active documents so that input and connection events only fire when the document is fully active.
| <ol class="algorithm"> | ||
| <li>Assert: |gamepad1| and |gamepad2| are not `null`. | ||
| </li> | ||
| <li>If [=list/size=] of |gamepad1|.{{Gamepad/[[axes]]}} is not equal |
There was a problem hiding this comment.
nit: prefer the possessive form:
If |gamepad1|.{{Gamepad/[[axes]]}}'s [=list/size=] is not equal to |gamepad2|.{{Gamepad/[[axes]]}}'s [=list/size=], return true.
| to the [=list/size=] of |gamepad2|.{{Gamepad/[[axes]]}}, return | ||
| `true`. | ||
| </li> | ||
| <li>[=list/For each=] |axisIndex:long| of |
There was a problem hiding this comment.
nit:
[=list/For each=] [=list/index=] |axisIndex| of |gamepad1|.{{Gamepad/[[axes]]}}:
| <li>[=list/For each=] |buttonIndex:long| of | ||
| |gamepad1|.{{Gamepad/[[buttons]]}}'s [=list/indices=]: | ||
| <ol> | ||
| <li>Let |button1:GamepadButton| be equal to |
There was a problem hiding this comment.
nit: Omit "equal to" in let statements
| <li>|touch1|.{{GamepadTouch/surfaceDimensions}} and | ||
| |touch2|.{{GamepadTouch/surfaceDimensions}} are both not | ||
| `null`, and any of the following are true: | ||
| <ol> |
There was a problem hiding this comment.
Use an unordered list
- for "any of the following"
| The <dfn class="event">gamepadrawinputchanged</dfn> event | ||
| </h2> | ||
| <p> | ||
| This event should be fired whenever the system [=receives new button or |
There was a problem hiding this comment.
SHOULD should be capitalized since it's an RFC 2119 keyword in a normative statement.
Alternatively, we can remove "should be" and say "This event is fired" to avoid the keyword. I think there are enough cases where the event is not fired that we don't want to use "should" here.
| are detected=] for a gamepad device. | ||
| </p> | ||
| <p> | ||
| [=User agents=] implementing this specification must provide a new DOM |
This PR specifies the API changes proposed in the explainer with some changes.
Origin trial feedback in Chromium said that the extra *Changed fields - e.g.
axesChanged- are not being used i their production code. Therefore, this PR makes the proposal a little simpler by removing theGamepadRawInputChangeEventmaking thegamepadrawinputchangedbe a regularGamepadEventCloses #4
Preview | Diff