Closed Bug 1627136 Opened 4 years ago Closed 4 years ago

Implement XRInputSourceEvent `select`, `selectstart`, `selectend`, `squeeze`, `squeezestart`, `squeezeend`

Categories

(Core :: WebVR, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: daoshengmu, Assigned: daoshengmu)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

https://www.w3.org/TR/webxr/#xrsessionevent-interface

We need to handle select events when pressing the primary action button.

Assignee: nobody → dmu
Priority: -- → P2
Blocks: 1419190
Summary: Implement XRInputSourceEvent `select`, `select`, `selectstart` and `selectend` → Implement XRInputSourceEvent `select`, `selectstart` and `selectend`
Summary: Implement XRInputSourceEvent `select`, `selectstart` and `selectend` → Implement XRInputSourceEvent `select`, `selectstart`, `selectend`, `squeeze`, `squeezestart`, `squeezeend`

Per spec [1], we will dispatch a XRInputSourceEvent, when users have one of select, squeeze gestures from [select, selectstart, selectend, squeeze, squeezestart, squeezeend].

In XRInputSourceEvent, it owns a XRFrame, we need to follow the rule as [2], When the user agent has to fire an input source event with a name , XRFrame frame, and XRInputSource source it MUST run the following steps:

  1. Create an XRInputSourceEvent event with type name, frame frame, and inputSource source
  2. Set frame’s active boolean to true.
  3. Dispatch event on frame’s session
  4. Set frame’s active boolean to false.

[1] https://immersive-web.github.io/webxr/#event-types
[2] https://immersive-web.github.io/webxr/#ref-for-xrframe-active

@kip, I am not sure if I can understand the meaning of select event from the spec.[1] They mentioned A user agent MUST dispatch a select event on an XRSession when one of its XRInputSources has fully completed a primary action. The event MUST be of type XRInputSourceEvent. .

What I did in this path is if users press its primary action button, I will dispatch the select event continuously. I also checked what Chrome did, it looks like they only dispatch the event when users start to release that button (< 1.0 f). Then, dispatch an end at the same time, even though the button value is still not zero yet. Sometimes, they even dispatch two times of start and end events. One is start releasing and the other time is fully release (very close to 0.0f, I guess they define a threshold). Their start event always comes with an end event, that is odd to me.

I consider to do that when start releasing the primary btn, dispatching a start event. Then, when it is going to less than my threshold (0.2f), I will dispatch an end event. How does it sound?

[1] https://immersive-web.github.io/webxr/#eventdef-xrsession-select

Flags: needinfo?(kgilbert)

(In reply to Daosheng Mu[:daoshengmu] from comment #3)

@kip, I am not sure if I can understand the meaning of select event from the spec.[1] They mentioned A user agent MUST dispatch a select event on an XRSession when one of its XRInputSources has fully completed a primary action. The event MUST be of type XRInputSourceEvent. .

What I did in this path is if users press its primary action button, I will dispatch the select event continuously. I also checked what Chrome did, it looks like they only dispatch the event when users start to release that button (< 1.0 f). Then, dispatch an end at the same time, even though the button value is still not zero yet. Sometimes, they even dispatch two times of start and end events. One is start releasing and the other time is fully release (very close to 0.0f, I guess they define a threshold). Their start event always comes with an end event, that is odd to me.

I consider to do that when start releasing the primary btn, dispatching a start event. Then, when it is going to less than my threshold (0.2f), I will dispatch an end event. How does it sound?

[1] https://immersive-web.github.io/webxr/#eventdef-xrsession-select

Part of the reason for the complexity is that there are devices that can generate these events without physical buttons. For example, a Hololens "bloom" gesture doesn't have a specific start and end time, but rather a moment that the gesture has been recognized. The select event is emitted at this point in time.

For a digital "on/off" primary action button:

When the button is pressed, emit selectstart as soon as we see the button pressed down.
When the button is released, emit a select immediately followed by a selectend.
If a controller is disconnected while the button is pressed, we should emit a selectend but not a select event.

For an analogue button such as a trigger:

This should act the same as the digital "on/off" button, but the analogue value is compared to fixed values to determine when it starts the "pressed" and "released" state. We should remember with a boolean value if it is "pressed" or not, and change its status by comparing with a threshold analogue value. The threshold for going from "not pressed" to "pressed" can be different than the threshold for going from "pressed" to "not pressed", but the end result is a boolean value toggling and acting like a digital "on/off" button for these events.

I hope this helps!

Flags: needinfo?(kgilbert)
Pushed by dmu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a80d91982e7f
Implement select and squeeze XRInputSourceEvent. r=kip,smaug
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: