Skip to content

Commit

Permalink
Remove buttonIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth authored and toji committed Jun 27, 2019
1 parent 3e3beef commit 650d812
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
4 changes: 0 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1957,22 +1957,18 @@ XRInputSourceEvent {#xrinputsourceevent-interface}
interface XRInputSourceEvent : Event {
[SameObject] readonly attribute XRFrame frame;
[SameObject] readonly attribute XRInputSource inputSource;
[SameObject] readonly attribute long? buttonIndex;
};

dictionary XRInputSourceEventInit : EventInit {
required XRFrame frame;
required XRInputSource inputSource;
long? buttonIndex = null;
};
</pre>

The <dfn attribute for="XRInputSourceEvent">inputSource</dfn> attribute indicates the {{XRInputSource}} that generated this event.

The <dfn attribute for="XRInputSourceEvent">frame</dfn> attribute is an {{XRFrame}} that corresponds with the time that the event took place. It may represent historical data. Any {{XRViewerPose}} queried from the {{XRInputSourceEvent/frame}} MUST have an empty {{XRViewerPose/views}} array.

The <dfn attribute for="XRInputSourceEvent">buttonIndex</dfn> attribute indicates the index of the button in the {{Gamepad/buttons}} array of the {{XRInputSourceEvent/inputSource}}'s {{XRInputSource/gamepad}} that caused the event to be generated. If the {{XRInputSource/gamepad}} is <code>null</code> or the event was not generated by a button interaction the values MUST be <code>null</code>.

<div class="algorithm" data-algorithm="fire-input-source-event">

When the user agent fires an {{XRInputSourceEvent}} |event| it MUST run the following steps:
Expand Down
4 changes: 1 addition & 3 deletions input-explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function onXRFrame(timestamp, frame) {
}
```

If the application includes interactions that require user activation (such as starting media playback), the application can listen to the `XRInputSource`s `select` events, which fire for every pressed and released button on the controller. When triggered by a controller input, the `XRInputSourceEvent` will include a `buttonIndex` other than `-1` to indicate which button on the gamepad triggered the event.
If the application includes interactions that require user activation (such as starting media playback), the application can listen to the `XRInputSource`s `select` events, which fire for the primary button on the controller.

The UA may update the `gamepad` state at any point, but it must remain constant while running a batch of `XRSession` `requestAnimationFrame` callbacks or event callbacks which provide an `XRFrame`.

Expand Down Expand Up @@ -462,12 +462,10 @@ dictionary XRInputSourceChangeEventInit : EventInit {
interface XRInputSourceEvent : Event {
readonly attribute XRFrame frame;
readonly attribute XRInputSource inputSource;
readonly attribute long buttonIndex;
};
dictionary XRInputSourceEventInit : EventInit {
required XRFrame frame;
required XRInputSource inputSource;
long buttonIndex = -1;
};
```

0 comments on commit 650d812

Please sign in to comment.