mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-25 01:01:52 +00:00
Bug 1630440 - Handle select and squeeze events when a VR controller's button only has pressed and unpressed. r=kip
Differential Revision: https://phabricator.services.mozilla.com/D71113 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
23b2665123
commit
a27bacb080
@ -273,10 +273,18 @@ void XRInputSource::Update(XRSession* aSession) {
|
||||
mSelectAction = ActionState::ActionState_Releasing;
|
||||
} else if (mSelectAction <= ActionState::ActionState_Releasing &&
|
||||
controllerState.triggerValue[selectIndex] < endThreshold) {
|
||||
// For a select btn which only has pressed and unpressed status.
|
||||
if (mSelectAction == ActionState::ActionState_Pressed) {
|
||||
DispatchEvent(NS_LITERAL_STRING("select"), aSession);
|
||||
}
|
||||
DispatchEvent(NS_LITERAL_STRING("selectend"), aSession);
|
||||
mSelectAction = ActionState::ActionState_Released;
|
||||
}
|
||||
} else if (mSelectAction <= ActionState::ActionState_Releasing) {
|
||||
// For a select btn which only has pressed and unpressed status.
|
||||
if (mSelectAction == ActionState::ActionState_Pressed) {
|
||||
DispatchEvent(NS_LITERAL_STRING("select"), aSession);
|
||||
}
|
||||
DispatchEvent(NS_LITERAL_STRING("selectend"), aSession);
|
||||
mSelectAction = ActionState::ActionState_Released;
|
||||
}
|
||||
@ -300,10 +308,18 @@ void XRInputSource::Update(XRSession* aSession) {
|
||||
mSqueezeAction = ActionState::ActionState_Releasing;
|
||||
} else if (mSqueezeAction <= ActionState::ActionState_Releasing &&
|
||||
controllerState.triggerValue[squeezeIndex] < endThreshold) {
|
||||
// For a squeeze btn which only has pressed and unpressed status.
|
||||
if (mSqueezeAction == ActionState::ActionState_Pressed) {
|
||||
DispatchEvent(NS_LITERAL_STRING("squeeze"), aSession);
|
||||
}
|
||||
DispatchEvent(NS_LITERAL_STRING("squeezeend"), aSession);
|
||||
mSqueezeAction = ActionState::ActionState_Released;
|
||||
}
|
||||
} else if (mSqueezeAction <= ActionState::ActionState_Releasing) {
|
||||
// For a squeeze btn which only has pressed and unpressed status.
|
||||
if (mSqueezeAction == ActionState::ActionState_Pressed) {
|
||||
DispatchEvent(NS_LITERAL_STRING("squeeze"), aSession);
|
||||
}
|
||||
DispatchEvent(NS_LITERAL_STRING("squeezeend"), aSession);
|
||||
mSqueezeAction = ActionState::ActionState_Released;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user