more CR changes

This commit is contained in:
Dante Ruiz 2018-12-12 15:29:01 -08:00
parent f3fad52e1d
commit 089a223c2d
3 changed files with 14 additions and 35 deletions

View file

@ -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<OverlayID> Keyboard::getKeysID() {

View file

@ -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 };

View file

@ -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();