mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Disable grab.js picks when in HMD
This commit is contained in:
parent
fcaa64b9ef
commit
79d09f68fd
1 changed files with 19 additions and 0 deletions
|
@ -221,6 +221,20 @@ function Grabber() {
|
|||
});
|
||||
}
|
||||
|
||||
Grabber.prototype.setPicksEnabled = function(enabled) {
|
||||
if (enabled) {
|
||||
Picks.enablePick(this.mouseRayOverlays);
|
||||
Pointers.enablePointer(this.mouseRayEntities);
|
||||
} else {
|
||||
Picks.disablePick(this.mouseRayOverlays);
|
||||
Pointers.disablePointer(this.mouseRayEntities);
|
||||
}
|
||||
}
|
||||
|
||||
Grabber.prototype.displayModeChanged = function(isHMDMode) {
|
||||
this.setPicksEnabled(!isHMDMode);
|
||||
}
|
||||
|
||||
Grabber.prototype.computeNewGrabPlane = function() {
|
||||
if (!this.isGrabbing) {
|
||||
return;
|
||||
|
@ -488,6 +502,10 @@ Grabber.prototype.cleanup = function() {
|
|||
|
||||
var grabber = new Grabber();
|
||||
|
||||
function displayModeChanged(isHMDMode) {
|
||||
grabber.displayModeChanged(isHMDMode);
|
||||
}
|
||||
|
||||
function pressEvent(event) {
|
||||
grabber.pressEvent(event);
|
||||
}
|
||||
|
@ -517,6 +535,7 @@ Controller.mouseMoveEvent.connect(moveEvent);
|
|||
Controller.mouseReleaseEvent.connect(releaseEvent);
|
||||
Controller.keyPressEvent.connect(keyPressEvent);
|
||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||
HMD.displayModeChanged.connect(displayModeChanged);
|
||||
Script.scriptEnding.connect(cleanup);
|
||||
|
||||
}()); // END LOCAL_SCOPE
|
||||
|
|
Loading…
Reference in a new issue