mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
tabs
This commit is contained in:
parent
9b33e6757f
commit
bc06b88afc
2 changed files with 41 additions and 41 deletions
|
@ -18,13 +18,13 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
Script.include("/~/system/libraries/utils.js");
|
||||
|
||||
(function () {
|
||||
var MARGIN = 25;
|
||||
|
||||
var MARGIN = 25;
|
||||
|
||||
function InEditMode(hand) {
|
||||
this.hand = hand;
|
||||
this.triggerClicked = false;
|
||||
this.selectedTarget = null;
|
||||
this.reticleMinX = MARGIN;
|
||||
this.reticleMinX = MARGIN;
|
||||
this.reticleMaxX;
|
||||
this.reticleMinY = MARGIN;
|
||||
this.reticleMaxY;
|
||||
|
@ -53,7 +53,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
return (HMD.tabletScreenID && objectID === HMD.tabletScreenID)
|
||||
|| (HMD.homeButtonID && objectID === HMD.homeButtonID);
|
||||
};
|
||||
|
||||
|
||||
this.calculateNewReticlePosition = function(intersection) {
|
||||
var dims = Controller.getViewportDimensions();
|
||||
this.reticleMaxX = dims.x - MARGIN;
|
||||
|
@ -88,24 +88,24 @@ Script.include("/~/system/libraries/utils.js");
|
|||
|
||||
this.triggerClicked = true;
|
||||
}
|
||||
|
||||
this.sendPointingAtData(controllerData);
|
||||
|
||||
this.sendPointingAtData(controllerData);
|
||||
};
|
||||
|
||||
this.sendPointingAtData = function(controllerData) {
|
||||
var rayPick = controllerData.rayPicks[this.hand];
|
||||
var hudRayPick = controllerData.hudRayPicks[this.hand];
|
||||
var point2d = this.calculateNewReticlePosition(hudRayPick.intersection);
|
||||
var desktopWindow = Window.isPointOnDesktopWindow(point2d);
|
||||
var tablet = this.pointingAtTablet(rayPick.objectID);
|
||||
var rightHand = this.hand === RIGHT_HAND;
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "pointingAt",
|
||||
desktopWindow: desktopWindow,
|
||||
tablet: tablet,
|
||||
rightHand: rightHand
|
||||
|
||||
this.sendPointingAtData = function(controllerData) {
|
||||
var rayPick = controllerData.rayPicks[this.hand];
|
||||
var hudRayPick = controllerData.hudRayPicks[this.hand];
|
||||
var point2d = this.calculateNewReticlePosition(hudRayPick.intersection);
|
||||
var desktopWindow = Window.isPointOnDesktopWindow(point2d);
|
||||
var tablet = this.pointingAtTablet(rayPick.objectID);
|
||||
var rightHand = this.hand === RIGHT_HAND;
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "pointingAt",
|
||||
desktopWindow: desktopWindow,
|
||||
tablet: tablet,
|
||||
rightHand: rightHand
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
this.exitModule = function() {
|
||||
return makeRunningValues(false, [], []);
|
||||
|
@ -137,7 +137,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
if (overlayLaser) {
|
||||
var overlayLaserReady = overlayLaser.isReady(controllerData);
|
||||
var target = controllerData.rayPicks[this.hand].objectID;
|
||||
this.sendPointingAtData(controllerData);
|
||||
this.sendPointingAtData(controllerData);
|
||||
if (overlayLaserReady.active && this.pointingAtTablet(target)) {
|
||||
return this.exitModule();
|
||||
}
|
||||
|
|
|
@ -59,13 +59,13 @@ SelectionManager = (function() {
|
|||
} else if (messageParsed.method === "clearSelection") {
|
||||
that.clearSelections();
|
||||
} else if (messageParsed.method === "pointingAt") {
|
||||
if (messageParsed.rightHand) {
|
||||
that.pointingAtDesktopWindowRight = messageParsed.desktopWindow;
|
||||
that.pointingAtTabletRight = messageParsed.tablet;
|
||||
} else {
|
||||
that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow;
|
||||
that.pointingAtTabletLeft = messageParsed.tablet;
|
||||
}
|
||||
if (messageParsed.rightHand) {
|
||||
that.pointingAtDesktopWindowRight = messageParsed.desktopWindow;
|
||||
that.pointingAtTabletRight = messageParsed.tablet;
|
||||
} else {
|
||||
that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow;
|
||||
that.pointingAtTabletLeft = messageParsed.tablet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,11 +101,11 @@ SelectionManager = (function() {
|
|||
that.worldDimensions = Vec3.ZERO;
|
||||
that.worldRegistrationPoint = Vec3.HALF;
|
||||
that.centerPosition = Vec3.ZERO;
|
||||
|
||||
that.pointingAtDesktopWindowLeft = false;
|
||||
that.pointingAtDesktopWindowRight = false;
|
||||
that.pointingAtTabletLeft = false;
|
||||
that.pointingAtTabletRight = false;
|
||||
|
||||
that.pointingAtDesktopWindowLeft = false;
|
||||
that.pointingAtDesktopWindowRight = false;
|
||||
that.pointingAtTabletLeft = false;
|
||||
that.pointingAtTabletRight = false;
|
||||
|
||||
that.saveProperties = function() {
|
||||
that.savedProperties = {};
|
||||
|
@ -680,16 +680,16 @@ SelectionDisplay = (function() {
|
|||
activeHand = (activeHand === Controller.Standard.RightHand) ?
|
||||
Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
||||
}
|
||||
var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand &&
|
||||
SelectionManager.pointingAtDesktopWindowRight) ||
|
||||
(hand === Controller.Standard.LeftHand &&
|
||||
SelectionManager.pointingAtDesktopWindowLeft);
|
||||
var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) ||
|
||||
(hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft);
|
||||
var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand &&
|
||||
SelectionManager.pointingAtDesktopWindowRight) ||
|
||||
(hand === Controller.Standard.LeftHand &&
|
||||
SelectionManager.pointingAtDesktopWindowLeft);
|
||||
var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) ||
|
||||
(hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft);
|
||||
if (pointingAtDesktopWindow || pointingAtTablet) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
that.mousePressEvent({});
|
||||
that.mousePressEvent({});
|
||||
} else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) {
|
||||
that.triggered = false;
|
||||
that.mouseReleaseEvent({});
|
||||
|
|
Loading…
Reference in a new issue