Implement XRInputSourceEvent `select`, `selectstart`, `selectend`, `squeeze`, `squeezestart`, `squeezeend`
Categories
(Core :: WebVR, task, P2)
Tracking
()
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 | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
Depends on D69483
Assignee | ||
Comment 2•4 years ago
|
||
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:
- Create an XRInputSourceEvent event with type name, frame frame, and inputSource source
- Set frame’s active boolean to true.
- Dispatch event on frame’s session
- 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
Assignee | ||
Comment 3•4 years ago
•
|
||
@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
Comment 4•4 years ago
|
||
(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 mentionedA 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 anend
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). Theirstart
event always comes with anend
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 anend
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!
Pushed by dmu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a80d91982e7f Implement select and squeeze XRInputSourceEvent. r=kip,smaug
Comment 6•4 years ago
|
||
bugherder |
Description
•