This commit is contained in:
David Rowe 2017-07-19 18:11:45 +12:00
parent e4123070c4
commit 2bd3f87d73

View file

@ -1310,6 +1310,7 @@
} }
function startDirectScaling(targetPosition) { function startDirectScaling(targetPosition) {
// Called on grabbing hand by scaling hand.
var initialTargetPosition, var initialTargetPosition,
initialTargetsCenter; initialTargetsCenter;
@ -1326,17 +1327,21 @@
} }
function updateDirectScaling(targetPosition) { function updateDirectScaling(targetPosition) {
// Called on grabbing hand by scaling hand.
otherTargetPosition = targetPosition; otherTargetPosition = targetPosition;
} }
function stopDirectScaling() { function stopDirectScaling() {
// Called on grabbing hand by scaling hand.
selection.finishDirectScaling(); selection.finishDirectScaling();
isDirectScaling = false; isDirectScaling = false;
} }
function startHandleScaling(targetPosition, overlayID) { function startHandleScaling(targetPosition, overlayID) {
// Called on grabbing hand by scaling hand.
var initialTargetPosition, var initialTargetPosition,
boundingBox, boundingBox,
selectionPositionAndOrientation,
scaleAxis, scaleAxis,
handDistance; handDistance;
@ -1375,10 +1380,12 @@
} }
function updateHandleScaling(targetPosition) { function updateHandleScaling(targetPosition) {
// Called on grabbing hand by scaling hand.
otherTargetPosition = targetPosition; otherTargetPosition = targetPosition;
} }
function stopHandleScaling() { function stopHandleScaling() {
// Called on grabbing hand by scaling hand.
handles.finishScaling(); handles.finishScaling();
selection.finishHandleScaling(); selection.finishHandleScaling();
handles.grab(null); // Stop highlighting grabbed handle and resume displaying all handles. handles.grab(null); // Stop highlighting grabbed handle and resume displaying all handles.
@ -1388,17 +1395,12 @@
function applyGrab() { function applyGrab() {
// Sets position and orientation of selection per grabbing hand. // Sets position and orientation of selection per grabbing hand.
var handPosition, var deltaOrientation,
handOrientation,
deltaOrientation,
selectionPosition, selectionPosition,
selectionOrientation; selectionOrientation;
handPosition = hand.position(); deltaOrientation = Quat.multiply(hand.orientation(), initialHandOrientationInverse);
handOrientation = hand.orientation(); selectionPosition = Vec3.sum(hand.position(), Vec3.multiplyQbyV(deltaOrientation, initialHandToSelectionVector));
deltaOrientation = Quat.multiply(handOrientation, initialHandOrientationInverse);
selectionPosition = Vec3.sum(handPosition, Vec3.multiplyQbyV(deltaOrientation, initialHandToSelectionVector));
selectionOrientation = Quat.multiply(deltaOrientation, initialSelectionOrientation); selectionOrientation = Quat.multiply(deltaOrientation, initialSelectionOrientation);
selection.setPositionAndOrientation(selectionPosition, selectionOrientation); selection.setPositionAndOrientation(selectionPosition, selectionOrientation);