diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index b5f561bff6..5970c0a57e 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -488,6 +488,10 @@ void Keyboard::switchToLayer(int layerIndex) { } } +bool Keyboard::shouldProcessOverlayAndPointerEvent(const PointerEvent& event, const OverlayID& overlayID) const { + return (shouldProcessPointerEvent(event) && shouldProcessOverlay(overlayID)); +} + bool Keyboard::shouldProcessPointerEvent(const PointerEvent& event) const { bool preferMalletsOverLasers = getPreferMalletsOverLasers(); unsigned int pointerID = event.getID(); @@ -497,12 +501,8 @@ bool Keyboard::shouldProcessPointerEvent(const PointerEvent& event) const { } void Keyboard::handleTriggerBegin(const OverlayID& overlayID, const PointerEvent& event) { - if (getExitEarly(overlayID)) { - return; - } - auto buttonType = event.getButton(); - if (!shouldProcessPointerEvent(event) || buttonType != PointerEvent::PrimaryButton) { + if (!shouldProcessOverlayAndPointerEvent(event, overlayID) || buttonType != PointerEvent::PrimaryButton) { return; } @@ -608,11 +608,7 @@ void Keyboard::setRightHandLaser(unsigned int rightHandLaser) { } void Keyboard::handleTriggerEnd(const OverlayID& overlayID, const PointerEvent& event) { - if (getExitEarly(overlayID)) { - return; - } - - if (!shouldProcessPointerEvent(event)) { + if (!shouldProcessOverlayAndPointerEvent(event, overlayID)) { return; } @@ -641,11 +637,7 @@ void Keyboard::handleTriggerEnd(const OverlayID& overlayID, const PointerEvent& } void Keyboard::handleTriggerContinue(const OverlayID& overlayID, const PointerEvent& event) { - if (getExitEarly(overlayID)) { - return; - } - - if (!shouldProcessPointerEvent(event)) { + if (!shouldProcessOverlayAndPointerEvent(event, overlayID)) { return; } @@ -684,11 +676,7 @@ void Keyboard::handleTriggerContinue(const OverlayID& overlayID, const PointerEv } void Keyboard::handleHoverBegin(const OverlayID& overlayID, const PointerEvent& event) { - if (getExitEarly(overlayID)) { - return; - } - - if (!shouldProcessPointerEvent(event)) { + if (!shouldProcessOverlayAndPointerEvent(event, overlayID)) { return; } @@ -704,11 +692,7 @@ void Keyboard::handleHoverBegin(const OverlayID& overlayID, const PointerEvent& } void Keyboard::handleHoverEnd(const OverlayID& overlayID, const PointerEvent& event) { - if (getExitEarly(overlayID)) { - return; - } - - if (!shouldProcessPointerEvent(event)) { + if (!shouldProcessOverlayAndPointerEvent(event, overlayID)) { return; } @@ -927,8 +911,8 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) { request->send(); } -bool Keyboard::getExitEarly(OverlayID overlayID) const { - return (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID); +bool Keyboard::shouldProcessOverlay(const OverlayID& overlayID) const { + return (!_keyboardLayers.empty() && isLayerSwitchTimerFinished() && overlayID != _backPlate.overlayID); } QVector Keyboard::getKeysID() { diff --git a/interface/src/ui/Keyboard.h b/interface/src/ui/Keyboard.h index f5a034334a..08f0ff46b9 100644 --- a/interface/src/ui/Keyboard.h +++ b/interface/src/ui/Keyboard.h @@ -152,13 +152,13 @@ private: void clearKeyboardKeys(); void switchToLayer(int layerIndex); void updateTextDisplay(); - bool getExitEarly(OverlayID overlayID) const; + bool shouldProcessOverlayAndPointerEvent(const PointerEvent& event, const OverlayID& overlayID) const; + bool shouldProcessPointerEvent(const PointerEvent& event) const; + bool shouldProcessOverlay(const OverlayID& overlayID) const; void startLayerSwitchTimer(); bool isLayerSwitchTimerFinished() const; - bool shouldProcessPointerEvent(const PointerEvent& event) const; - bool _raised { false }; bool _password { false }; bool _capsEnabled { false }; diff --git a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js index 1dc8bbf023..ec35dfe081 100644 --- a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js +++ b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js @@ -246,11 +246,6 @@ Script.include("/~/system/libraries/controllers.js"); } else if ((type === intersectionType["HifiKeyboard"] && laserOn) || type === intersectionType["Overlay"]) { this.running = true; return makeRunningValues(true, [], []); - } else if (isTriggerPressed && !this.getInteractableType(controllerData, isTriggerPressed, true)) { - // if trigger is down + not pointing at a web entity, keep running web surface laser - this.running = true; - return makeRunningValues(true, [], []); - } this.deleteContextOverlay();