From 2bd3f87d73d00842b210b4a32e3f43f735f62d70 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 19 Jul 2017 18:11:45 +1200 Subject: [PATCH] Tidying --- scripts/vr-edit/vr-edit.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/vr-edit/vr-edit.js b/scripts/vr-edit/vr-edit.js index 89ed0756b1..99f160c6a5 100644 --- a/scripts/vr-edit/vr-edit.js +++ b/scripts/vr-edit/vr-edit.js @@ -1310,6 +1310,7 @@ } function startDirectScaling(targetPosition) { + // Called on grabbing hand by scaling hand. var initialTargetPosition, initialTargetsCenter; @@ -1326,17 +1327,21 @@ } function updateDirectScaling(targetPosition) { + // Called on grabbing hand by scaling hand. otherTargetPosition = targetPosition; } function stopDirectScaling() { + // Called on grabbing hand by scaling hand. selection.finishDirectScaling(); isDirectScaling = false; } function startHandleScaling(targetPosition, overlayID) { + // Called on grabbing hand by scaling hand. var initialTargetPosition, boundingBox, + selectionPositionAndOrientation, scaleAxis, handDistance; @@ -1375,10 +1380,12 @@ } function updateHandleScaling(targetPosition) { + // Called on grabbing hand by scaling hand. otherTargetPosition = targetPosition; } function stopHandleScaling() { + // Called on grabbing hand by scaling hand. handles.finishScaling(); selection.finishHandleScaling(); handles.grab(null); // Stop highlighting grabbed handle and resume displaying all handles. @@ -1388,17 +1395,12 @@ function applyGrab() { // Sets position and orientation of selection per grabbing hand. - var handPosition, - handOrientation, - deltaOrientation, + var deltaOrientation, selectionPosition, selectionOrientation; - handPosition = hand.position(); - handOrientation = hand.orientation(); - - deltaOrientation = Quat.multiply(handOrientation, initialHandOrientationInverse); - selectionPosition = Vec3.sum(handPosition, Vec3.multiplyQbyV(deltaOrientation, initialHandToSelectionVector)); + deltaOrientation = Quat.multiply(hand.orientation(), initialHandOrientationInverse); + selectionPosition = Vec3.sum(hand.position(), Vec3.multiplyQbyV(deltaOrientation, initialHandToSelectionVector)); selectionOrientation = Quat.multiply(deltaOrientation, initialSelectionOrientation); selection.setPositionAndOrientation(selectionPosition, selectionOrientation);