mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 21:33:48 +02:00
make CR changes
This commit is contained in:
parent
51bdf1bf78
commit
f3fad52e1d
7 changed files with 29 additions and 30 deletions
|
@ -406,7 +406,7 @@ void Keyboard::startLayerSwitchTimer() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Keyboard::isLayerSwitchTimerFinished() {
|
||||
bool Keyboard::isLayerSwitchTimerFinished() const {
|
||||
if (_layerSwitchTimer) {
|
||||
return (_layerSwitchTimer->remainingTime() <= 0);
|
||||
}
|
||||
|
@ -493,12 +493,11 @@ bool Keyboard::shouldProcessPointerEvent(const PointerEvent& event) const {
|
|||
unsigned int pointerID = event.getID();
|
||||
bool isStylusEvent = (pointerID == _leftHandStylus || pointerID == _rightHandStylus);
|
||||
bool isLaserEvent = (pointerID == _leftHandLaser || pointerID == _rightHandLaser);
|
||||
qDebug() << isLaserEvent;
|
||||
return ((isStylusEvent && preferMalletsOverLasers) || (isLaserEvent && !preferMalletsOverLasers));
|
||||
}
|
||||
|
||||
void Keyboard::handleTriggerBegin(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID) {
|
||||
if (getExitEarly(overlayID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -609,7 +608,7 @@ void Keyboard::setRightHandLaser(unsigned int rightHandLaser) {
|
|||
}
|
||||
|
||||
void Keyboard::handleTriggerEnd(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID) {
|
||||
if (getExitEarly(overlayID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -642,7 +641,7 @@ void Keyboard::handleTriggerEnd(const OverlayID& overlayID, const PointerEvent&
|
|||
}
|
||||
|
||||
void Keyboard::handleTriggerContinue(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID) {
|
||||
if (getExitEarly(overlayID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -685,7 +684,7 @@ void Keyboard::handleTriggerContinue(const OverlayID& overlayID, const PointerEv
|
|||
}
|
||||
|
||||
void Keyboard::handleHoverBegin(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID) {
|
||||
if (getExitEarly(overlayID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -705,7 +704,7 @@ void Keyboard::handleHoverBegin(const OverlayID& overlayID, const PointerEvent&
|
|||
}
|
||||
|
||||
void Keyboard::handleHoverEnd(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID) {
|
||||
if (getExitEarly(overlayID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -928,6 +927,10 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) {
|
|||
request->send();
|
||||
}
|
||||
|
||||
bool Keyboard::getExitEarly(OverlayID overlayID) const {
|
||||
return (_keyboardLayers.empty() || !isLayerSwitchTimerFinished() || overlayID == _backPlate.overlayID);
|
||||
}
|
||||
|
||||
QVector<OverlayID> Keyboard::getKeysID() {
|
||||
return _ignoreItemsLock.resultWithReadLock<QVector<OverlayID>>([&] {
|
||||
return _itemsToIgnore;
|
||||
|
@ -956,13 +959,9 @@ void Keyboard::clearKeyboardKeys() {
|
|||
|
||||
void Keyboard::enableStylus() {
|
||||
if (getPreferMalletsOverLasers()) {
|
||||
auto pointerManager = DependencyManager::get<PointerManager>();
|
||||
pointerManager->setRenderState(_leftHandStylus, "events on");
|
||||
pointerManager->enablePointer(_leftHandStylus);
|
||||
pointerManager->setRenderState(_rightHandStylus, "events on");
|
||||
pointerManager->enablePointer(_rightHandStylus);
|
||||
enableRightMallet();
|
||||
enableLeftMallet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Keyboard::enableRightMallet() {
|
||||
|
|
|
@ -152,9 +152,10 @@ private:
|
|||
void clearKeyboardKeys();
|
||||
void switchToLayer(int layerIndex);
|
||||
void updateTextDisplay();
|
||||
bool getExitEarly(OverlayID overlayID) const;
|
||||
|
||||
void startLayerSwitchTimer();
|
||||
bool isLayerSwitchTimerFinished();
|
||||
bool isLayerSwitchTimerFinished() const;
|
||||
|
||||
bool shouldProcessPointerEvent(const PointerEvent& event) const;
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ public:
|
|||
const QStringList& getItems() { return _items; }
|
||||
void setHeading(const QString& heading) { _heading = heading; }
|
||||
void setItems(const QStringList& items) { _items = items; }
|
||||
bool getIndented() { return _indented; }
|
||||
bool getIndented() const { return _indented; }
|
||||
void setIndented(const bool indented) { _indented = indented; }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -453,7 +453,6 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
distanceScaleEnd: true,
|
||||
hand: LEFT_HAND
|
||||
});
|
||||
|
||||
Keyboard.setLeftHandLaser(this.leftPointer);
|
||||
this.rightPointer = this.pointerManager.createPointer(false, PickType.Ray, {
|
||||
joint: "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND",
|
||||
|
|
|
@ -125,7 +125,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.ignoredObjects = [];
|
||||
};
|
||||
|
||||
this.isPointingAtTriggerable = function(controllerData, triggerPressed, checkEntitiesOnly) {
|
||||
this.getInteractableType = function(controllerData, triggerPressed, checkEntitiesOnly) {
|
||||
// allow pointing at tablet, unlocked web entities, or web overlays automatically without pressing trigger,
|
||||
// but for pointing at locked web entities or non-web overlays user must be pressing trigger
|
||||
var intersection = controllerData.rayPicks[this.hand];
|
||||
|
@ -175,7 +175,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.updateAlwaysOn = function(type) {
|
||||
var PREFER_STYLUS_OVER_LASER = "preferStylusOverLaser";
|
||||
this.parameters.handLaser.allwaysOn = (!Settings.getValue(PREFER_STYLUS_OVER_LASER, false) || type === intersectionType["HifiKeyboard"]);
|
||||
this.parameters.handLaser.alwaysOn = (!Settings.getValue(PREFER_STYLUS_OVER_LASER, false) || type === intersectionType["HifiKeyboard"]);
|
||||
};
|
||||
|
||||
this.getDominantHand = function() {
|
||||
|
@ -186,8 +186,8 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.isReady = function(controllerData) {
|
||||
var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&
|
||||
controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
|
||||
var type = this.isPointingAtTriggerable(controllerData, isTriggerPressed, false);
|
||||
controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
|
||||
var type = this.getInteractableType(controllerData, isTriggerPressed, false);
|
||||
|
||||
if (type !== intersectionType["None"] && !this.grabModuleWantsNearbyOverlay(controllerData)) {
|
||||
if (type === intersectionType["WebOverlay"] || type === intersectionType["WebEntity"] || type === intersectionType["HifiTablet"]) {
|
||||
|
@ -206,7 +206,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
}
|
||||
|
||||
this.updateAlwaysOn(type);
|
||||
if (this.parameters.handLaser.allwaysOn || isTriggerPressed) {
|
||||
if (this.parameters.handLaser.alwaysOn || isTriggerPressed) {
|
||||
return makeRunningValues(true, [], []);
|
||||
}
|
||||
}
|
||||
|
@ -228,9 +228,9 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.run = function(controllerData, deltaTime) {
|
||||
this.addObjectToIgnoreList(controllerData);
|
||||
var type = this.isPointingAtTriggerable(controllerData, isTriggerPressed, false);
|
||||
var type = this.getInteractableType(controllerData, isTriggerPressed, false);
|
||||
var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE;
|
||||
var laserOn = isTriggerPressed || this.parameters.handLaser.allwaysOn;
|
||||
var laserOn = isTriggerPressed || this.parameters.handLaser.alwaysOn;
|
||||
this.addObjectToIgnoreList(controllerData);
|
||||
|
||||
if (type === intersectionType["HifiTablet"] && laserOn) {
|
||||
|
@ -246,7 +246,7 @@ 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.isPointingAtTriggerable(controllerData, isTriggerPressed, 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, [], []);
|
||||
|
|
|
@ -181,14 +181,14 @@ makeLaserLockInfo = function(targetID, isOverlay, hand, offset) {
|
|||
};
|
||||
};
|
||||
|
||||
makeLaserParams = function(hand, allwaysOn) {
|
||||
if (allwaysOn === undefined) {
|
||||
allwaysOn = false;
|
||||
makeLaserParams = function(hand, alwaysOn) {
|
||||
if (alwaysOn === undefined) {
|
||||
alwaysOn = false;
|
||||
}
|
||||
|
||||
return {
|
||||
hand: hand,
|
||||
allwaysOn: allwaysOn
|
||||
alwaysOn: alwaysOn
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
mode = "hold";
|
||||
} else if (triggerClicks[this.hand]) {
|
||||
mode = "full";
|
||||
} else if (triggerValues[this.hand] > TRIGGER_ON_VALUE || this.allwaysOn) {
|
||||
} else if (triggerValues[this.hand] > TRIGGER_ON_VALUE || this.alwaysOn) {
|
||||
mode = "half";
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ PointerManager = function() {
|
|||
var index = laserParams.hand;
|
||||
if (index < this.pointers.length && index >= 0) {
|
||||
this.pointers[index].makeVisible();
|
||||
this.pointers[index].allwaysOn = laserParams.allwaysOn;
|
||||
this.pointers[index].alwaysOn = laserParams.alwaysOn;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue