mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 04:48:09 +02:00
- fix create-app camera orbit to not jump around on secondary monitor
- style fixes entityCameraTool.js
This commit is contained in:
parent
aae38165b8
commit
a06c9eccca
1 changed files with 20 additions and 20 deletions
|
@ -91,7 +91,7 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var CAPTURED_KEYS = [];
|
var CAPTURED_KEYS = [];
|
||||||
for (key in keyToActionMapping) {
|
for (var key in keyToActionMapping) {
|
||||||
CAPTURED_KEYS.push(key);
|
CAPTURED_KEYS.push(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +99,9 @@ CameraManager = function() {
|
||||||
var action = keyToActionMapping[event.text];
|
var action = keyToActionMapping[event.text];
|
||||||
if (action !== undefined) {
|
if (action !== undefined) {
|
||||||
if (event.isShifted) {
|
if (event.isShifted) {
|
||||||
if (action == "orbitForward") {
|
if (action === "orbitForward") {
|
||||||
action = "orbitUp";
|
action = "orbitUp";
|
||||||
} else if (action == "orbitBackward") {
|
} else if (action === "orbitBackward") {
|
||||||
action = "orbitDown";
|
action = "orbitDown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ CameraManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.enable = function() {
|
that.enable = function() {
|
||||||
if (Camera.mode == "independent" || that.enabled || HMD.active) {
|
if (Camera.mode === "independent" || that.enabled || HMD.active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.setFocalPoint = function(pos) {
|
that.setFocalPoint = function(pos) {
|
||||||
that.targetFocalPoint = pos
|
that.targetFocalPoint = pos;
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.mouseMoveEvent = function(event) {
|
that.mouseMoveEvent = function(event) {
|
||||||
if (that.enabled && that.mode != MODE_INACTIVE) {
|
if (that.enabled && that.mode !== MODE_INACTIVE) {
|
||||||
var x = Reticle.getPosition().x;
|
var x = Reticle.getPosition().x;
|
||||||
var y = Reticle.getPosition().y;
|
var y = Reticle.getPosition().y;
|
||||||
if (!hasDragged) {
|
if (!hasDragged) {
|
||||||
|
@ -284,11 +284,11 @@ CameraManager = function() {
|
||||||
that.lastMousePosition.y = y;
|
that.lastMousePosition.y = y;
|
||||||
hasDragged = true;
|
hasDragged = true;
|
||||||
}
|
}
|
||||||
if (that.mode == MODE_ORBIT) {
|
if (that.mode === MODE_ORBIT) {
|
||||||
var diffX = x - that.lastMousePosition.x;
|
var diffX = x - that.lastMousePosition.x;
|
||||||
var diffY = y - that.lastMousePosition.y;
|
var diffY = y - that.lastMousePosition.y;
|
||||||
that.targetYaw -= MOUSE_SENSITIVITY * (diffX / 5.0)
|
that.targetYaw -= MOUSE_SENSITIVITY * (diffX / 5.0);
|
||||||
that.targetPitch += MOUSE_SENSITIVITY * (diffY / 10.0)
|
that.targetPitch += MOUSE_SENSITIVITY * (diffY / 10.0);
|
||||||
|
|
||||||
while (that.targetYaw > 180.0) that.targetYaw -= 360;
|
while (that.targetYaw > 180.0) that.targetYaw -= 360;
|
||||||
while (that.targetYaw < -180.0) that.targetYaw += 360;
|
while (that.targetYaw < -180.0) that.targetYaw += 360;
|
||||||
|
@ -297,7 +297,7 @@ CameraManager = function() {
|
||||||
if (that.targetPitch < -90) that.targetPitch = -90;
|
if (that.targetPitch < -90) that.targetPitch = -90;
|
||||||
|
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
} else if (that.mode == MODE_PAN) {
|
} else if (that.mode === MODE_PAN) {
|
||||||
var diffX = x - that.lastMousePosition.x;
|
var diffX = x - that.lastMousePosition.x;
|
||||||
var diffY = y - that.lastMousePosition.y;
|
var diffY = y - that.lastMousePosition.y;
|
||||||
|
|
||||||
|
@ -316,19 +316,19 @@ CameraManager = function() {
|
||||||
var newY = y;
|
var newY = y;
|
||||||
var updatePosition = false;
|
var updatePosition = false;
|
||||||
|
|
||||||
if (x <= Window.x) {
|
if (x < 0) {
|
||||||
newX = Window.x + Window.innerWidth;
|
newX = Window.innerWidth;
|
||||||
updatePosition = true;
|
updatePosition = true;
|
||||||
} else if (x >= (Window.x + Window.innerWidth)) {
|
} else if (x > Window.innerWidth) {
|
||||||
newX = Window.x;
|
newX = 0;
|
||||||
updatePosition = true;
|
updatePosition = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y <= Window.y) {
|
if (y < 0) {
|
||||||
newY = Window.y + Window.innerHeight;
|
newY = Window.innerHeight;
|
||||||
updatePosition = true;
|
updatePosition = true;
|
||||||
} else if (y >= (Window.y + Window.innerHeight)) {
|
} else if (y > Window.innerHeight) {
|
||||||
newY = Window.y;
|
newY = 0;
|
||||||
updatePosition = true;
|
updatePosition = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.updateCamera = function() {
|
that.updateCamera = function() {
|
||||||
if (!that.enabled || Camera.mode != "independent") {
|
if (!that.enabled || Camera.mode !== "independent") {
|
||||||
cameraTool.update();
|
cameraTool.update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ CameraManager = function() {
|
||||||
|
|
||||||
// Ease the position and orbit of the camera
|
// Ease the position and orbit of the camera
|
||||||
that.update = function(dt) {
|
that.update = function(dt) {
|
||||||
if (Camera.mode != "independent") {
|
if (Camera.mode !== "independent") {
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue