mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 21:28:54 +02:00
Simplify scale-with-handles state handling
This commit is contained in:
parent
7933280d03
commit
ee21797fcd
1 changed files with 8 additions and 17 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
// Application state
|
// Application state
|
||||||
isAppActive = false,
|
isAppActive = false,
|
||||||
isScaleWithHandles = false,
|
isAppScaleWithHandles = false,
|
||||||
|
|
||||||
VR_EDIT_SETTING = "io.highfidelity.isVREditing", // Note: This constant is duplicated in utils.js.
|
VR_EDIT_SETTING = "io.highfidelity.isVREditing", // Note: This constant is duplicated in utils.js.
|
||||||
|
|
||||||
|
@ -768,8 +768,6 @@
|
||||||
handPose,
|
handPose,
|
||||||
intersection = {},
|
intersection = {},
|
||||||
|
|
||||||
isScaleWithHandles = false,
|
|
||||||
|
|
||||||
isLaserOn = false,
|
isLaserOn = false,
|
||||||
hoveredEntityID = null,
|
hoveredEntityID = null,
|
||||||
|
|
||||||
|
@ -822,10 +820,6 @@
|
||||||
otherHand = hand;
|
otherHand = hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setScaleWithHandles(value) {
|
|
||||||
isScaleWithHandles = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIsEditing(rootEntityID) {
|
function getIsEditing(rootEntityID) {
|
||||||
return isEditing && rootEntityID === selection.rootEntityID();
|
return isEditing && rootEntityID === selection.rootEntityID();
|
||||||
}
|
}
|
||||||
|
@ -1089,7 +1083,7 @@
|
||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
// Perform edit.
|
// Perform edit.
|
||||||
doEdit = true;
|
doEdit = true;
|
||||||
} else if (intersection.intersects && intersection.entityID && (!isScaleWithHandles
|
} else if (intersection.intersects && intersection.entityID && (!isAppScaleWithHandles
|
||||||
|| !otherHand.isEditing(Entities.rootOf(intersection.entityID)))) {
|
|| !otherHand.isEditing(Entities.rootOf(intersection.entityID)))) {
|
||||||
// Start editing.
|
// Start editing.
|
||||||
if (intersection.entityID !== hoveredEntityID) {
|
if (intersection.entityID !== hoveredEntityID) {
|
||||||
|
@ -1101,7 +1095,7 @@
|
||||||
laserEditingDistance = laserLength;
|
laserEditingDistance = laserLength;
|
||||||
}
|
}
|
||||||
startEditing();
|
startEditing();
|
||||||
if (isScaleWithHandles) {
|
if (isAppScaleWithHandles) {
|
||||||
handles.display(selection.rootEntityID(), selection.boundingBox(), selection.count() > 1);
|
handles.display(selection.rootEntityID(), selection.boundingBox(), selection.count() > 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1105,7 @@
|
||||||
// Stop editing.
|
// Stop editing.
|
||||||
stopEditing();
|
stopEditing();
|
||||||
}
|
}
|
||||||
if (isScaleWithHandles) {
|
if (isAppScaleWithHandles) {
|
||||||
otherHand.hoverHandle(intersection.overlayID);
|
otherHand.hoverHandle(intersection.overlayID);
|
||||||
}
|
}
|
||||||
if (intersection.intersects && intersection.entityID) {
|
if (intersection.intersects && intersection.entityID) {
|
||||||
|
@ -1136,16 +1130,16 @@
|
||||||
function apply() {
|
function apply() {
|
||||||
if (doEdit) {
|
if (doEdit) {
|
||||||
if (otherHand.isEditing(selection.rootEntityID())) {
|
if (otherHand.isEditing(selection.rootEntityID())) {
|
||||||
if (isScaling && !isScaleWithHandles) {
|
if (isScaling && !isAppScaleWithHandles) {
|
||||||
applyScale();
|
applyScale();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
applyGrab();
|
applyGrab();
|
||||||
}
|
}
|
||||||
} else if (doHighlight) {
|
} else if (doHighlight) {
|
||||||
if (!isScaleWithHandles || !otherHand.isEditing(selection.rootEntityID())) {
|
if (!isAppScaleWithHandles || !otherHand.isEditing(selection.rootEntityID())) {
|
||||||
highlights.display(intersection.handSelected, selection.selection(),
|
highlights.display(intersection.handSelected, selection.selection(),
|
||||||
otherHand.isEditing(selection.rootEntityID()) || isScaleWithHandles);
|
otherHand.isEditing(selection.rootEntityID()) || isAppScaleWithHandles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1181,6 @@
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setOtherHand: setOtherHand,
|
setOtherHand: setOtherHand,
|
||||||
setScaleWithHandles: setScaleWithHandles,
|
|
||||||
isEditing: getIsEditing,
|
isEditing: getIsEditing,
|
||||||
hoverHandle: hoverHandle,
|
hoverHandle: hoverHandle,
|
||||||
getTargetPosition: getTargetPosition,
|
getTargetPosition: getTargetPosition,
|
||||||
|
@ -1234,9 +1227,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGripClicked() {
|
function onGripClicked() {
|
||||||
isScaleWithHandles = !isScaleWithHandles;
|
isAppScaleWithHandles = !isAppScaleWithHandles;
|
||||||
hands[LEFT_HAND].setScaleWithHandles(isScaleWithHandles);
|
|
||||||
hands[RIGHT_HAND].setScaleWithHandles(isScaleWithHandles);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
|
Loading…
Reference in a new issue