mirror of
https://github.com/overte-org/overte.git
synced 2025-07-06 07:49:41 +02:00
Disable moving selection when camera is in inside bounding box
This commit is contained in:
parent
8fd972fce9
commit
1ccde9a1b2
1 changed files with 16 additions and 7 deletions
|
@ -574,7 +574,7 @@ SelectionDisplay = (function() {
|
||||||
handleScaleFREdge,
|
handleScaleFREdge,
|
||||||
handleScaleFLEdge,
|
handleScaleFLEdge,
|
||||||
handleCloner,
|
handleCloner,
|
||||||
selectionBox
|
selectionBox // Must be last overlay.
|
||||||
];
|
];
|
||||||
|
|
||||||
overlayNames[handleTranslateXCone] = "handleTranslateXCone";
|
overlayNames[handleTranslateXCone] = "handleTranslateXCone";
|
||||||
|
@ -691,6 +691,13 @@ SelectionDisplay = (function() {
|
||||||
return intersectObj;
|
return intersectObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPointInsideBox(point, box) {
|
||||||
|
var position = Vec3.subtract(point, box.position);
|
||||||
|
position = Vec3.multiplyQbyV(Quat.inverse(box.rotation), position);
|
||||||
|
return Math.abs(position.x) <= box.dimensions.x / 2 && Math.abs(position.y) <= box.dimensions.y / 2
|
||||||
|
&& Math.abs(position.z) <= box.dimensions.z / 2;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: MOUSE PRESS EVENT
|
// FUNCTION: MOUSE PRESS EVENT
|
||||||
that.mousePressEvent = function (event) {
|
that.mousePressEvent = function (event) {
|
||||||
var wantDebug = false;
|
var wantDebug = false;
|
||||||
|
@ -1307,12 +1314,13 @@ SelectionDisplay = (function() {
|
||||||
var inModeRotate = isActiveTool(handleRotatePitchRing) ||
|
var inModeRotate = isActiveTool(handleRotatePitchRing) ||
|
||||||
isActiveTool(handleRotateYawRing) ||
|
isActiveTool(handleRotateYawRing) ||
|
||||||
isActiveTool(handleRotateRollRing);
|
isActiveTool(handleRotateRollRing);
|
||||||
Overlays.editOverlay(selectionBox, {
|
var selectionBoxGeometry = {
|
||||||
position: position,
|
position: position,
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
dimensions: dimensions,
|
dimensions: dimensions
|
||||||
visible: !inModeRotate
|
};
|
||||||
});
|
selectionBoxGeometry.visible = !inModeRotate && !isPointInsideBox(Camera.position, selectionBoxGeometry);
|
||||||
|
Overlays.editOverlay(selectionBox, selectionBoxGeometry);
|
||||||
|
|
||||||
// UPDATE CLONER (CURRENTLY HIDDEN FOR NOW)
|
// UPDATE CLONER (CURRENTLY HIDDEN FOR NOW)
|
||||||
var handleClonerOffset = {
|
var handleClonerOffset = {
|
||||||
|
@ -1383,8 +1391,9 @@ SelectionDisplay = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// FUNCTION: SET OVERLAYS VISIBLE
|
// FUNCTION: SET OVERLAYS VISIBLE
|
||||||
that.setOverlaysVisible = function(isVisible) {
|
that.setOverlaysVisible = function (isVisible) {
|
||||||
for (var i = 0; i < allOverlays.length; i++) {
|
// Don't set selectionBox (last) overlay's visibility.
|
||||||
|
for (var i = 0, length = allOverlays.length - 1; i < length; i++) {
|
||||||
Overlays.editOverlay(allOverlays[i], { visible: isVisible });
|
Overlays.editOverlay(allOverlays[i], { visible: isVisible });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue