mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Merge pull request #8135 from SamGondelman/fixEditLockHMD
Prevent entering independent camera mode through edit.js in HMD mode
This commit is contained in:
commit
1af455b8b9
1 changed files with 21 additions and 16 deletions
|
@ -141,7 +141,9 @@ CameraManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.enable = function() {
|
that.enable = function() {
|
||||||
if (Camera.mode == "independent" || that.enabled) return;
|
if (Camera.mode == "independent" || that.enabled || HMD.active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < CAPTURED_KEYS.length; i++) {
|
for (var i = 0; i < CAPTURED_KEYS.length; i++) {
|
||||||
Controller.captureKeyEvents({
|
Controller.captureKeyEvents({
|
||||||
|
@ -179,7 +181,9 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.disable = function(ignoreCamera) {
|
that.disable = function(ignoreCamera) {
|
||||||
if (!that.enabled) return;
|
if (!that.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < CAPTURED_KEYS.length; i++) {
|
for (var i = 0; i < CAPTURED_KEYS.length; i++) {
|
||||||
Controller.releaseKeyEvents({
|
Controller.releaseKeyEvents({
|
||||||
|
@ -352,27 +356,21 @@ CameraManager = function() {
|
||||||
that.mousePressEvent = function(event) {
|
that.mousePressEvent = function(event) {
|
||||||
|
|
||||||
if (cameraTool.mousePressEvent(event)) {
|
if (cameraTool.mousePressEvent(event)) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!that.enabled) {
|
||||||
if (!that.enabled) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.isRightButton || (event.isLeftButton && event.isControl && !event.isShifted)) {
|
if (event.isRightButton || (event.isLeftButton && event.isControl && !event.isShifted)) {
|
||||||
|
|
||||||
that.mode = MODE_ORBIT;
|
that.mode = MODE_ORBIT;
|
||||||
} else if (event.isMiddleButton || (event.isLeftButton && event.isControl && event.isShifted)) {
|
} else if (event.isMiddleButton || (event.isLeftButton && event.isControl && event.isShifted)) {
|
||||||
|
|
||||||
|
|
||||||
that.mode = MODE_PAN;
|
that.mode = MODE_PAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (that.mode !== MODE_INACTIVE) {
|
if (that.mode !== MODE_INACTIVE) {
|
||||||
|
|
||||||
|
|
||||||
hasDragged = false;
|
hasDragged = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +379,9 @@ CameraManager = function() {
|
||||||
|
|
||||||
that.mouseReleaseEvent = function(event) {
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
|
||||||
if (!that.enabled) return;
|
if (!that.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
that.mode = MODE_INACTIVE;
|
that.mode = MODE_INACTIVE;
|
||||||
Reticle.setVisible(true);
|
Reticle.setVisible(true);
|
||||||
|
@ -403,7 +403,9 @@ CameraManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.wheelEvent = function(event) {
|
that.wheelEvent = function(event) {
|
||||||
if (!that.enabled) return;
|
if (!that.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var dZoom = -event.delta * SCROLL_SENSITIVITY;
|
var dZoom = -event.delta * SCROLL_SENSITIVITY;
|
||||||
|
|
||||||
|
@ -459,8 +461,12 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeDegrees(degrees) {
|
function normalizeDegrees(degrees) {
|
||||||
while (degrees > 180) degrees -= 360;
|
while (degrees > 180) {
|
||||||
while (degrees < -180) degrees += 360;
|
degrees -= 360;
|
||||||
|
}
|
||||||
|
while (degrees < -180) {
|
||||||
|
degrees += 360;
|
||||||
|
}
|
||||||
return degrees;
|
return degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +489,6 @@ CameraManager = function() {
|
||||||
that.targetZoomDistance = clamp(that.targetZoomDistance, MIN_ZOOM_DISTANCE, MAX_ZOOM_DISTANCE);
|
that.targetZoomDistance = clamp(that.targetZoomDistance, MIN_ZOOM_DISTANCE, MAX_ZOOM_DISTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (easing) {
|
if (easing) {
|
||||||
easingTime = Math.min(EASE_TIME, easingTime + dt);
|
easingTime = Math.min(EASE_TIME, easingTime + dt);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue