dry up some code

This commit is contained in:
ZappoMan 2014-10-03 03:12:09 -07:00
parent 4af3968e01
commit 88c983cd3b

View file

@ -881,31 +881,11 @@ SelectionDisplay = (function () {
switch(result.overlayID) {
case grabberMoveUp:
mode = "TRANSLATE_UP_DOWN";
pickRay = Camera.computePickRay(event.x, event.y);
lastPlaneIntersection = rayPlaneIntersection(pickRay, selectedEntityPropertiesOriginalPosition,
Quat.getFront(lastAvatarOrientation));
if (wantDebug) {
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
print(" event.y:" + event.y);
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
Vec3.print(" originalPosition:", selectedEntityPropertiesOriginalPosition);
}
somethingClicked = true;
break;
case grabberRBN:
mode = "STRETCH_RBN";
pickRay = Camera.computePickRay(event.x, event.y);
lastPlaneIntersection = rayPlaneIntersection(pickRay, selectedEntityPropertiesOriginalPosition,
Quat.getFront(lastAvatarOrientation));
if (wantDebug) {
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
print(" event.y:" + event.y);
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
Vec3.print(" originalPosition:", selectedEntityPropertiesOriginalPosition);
}
somethingClicked = true;
break;
@ -913,17 +893,6 @@ SelectionDisplay = (function () {
case grabberEdgeTN:
case grabberEdgeBN:
mode = "STRETCH_NEAR";
pickRay = Camera.computePickRay(event.x, event.y);
lastPlaneIntersection = rayPlaneIntersection(pickRay, selectedEntityPropertiesOriginalPosition,
Quat.getFront(lastAvatarOrientation));
if (wantDebug) {
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
print(" event.y:" + event.y);
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
Vec3.print(" originalPosition:", selectedEntityPropertiesOriginalPosition);
print(" mode:" + mode);
}
somethingClicked = true;
break;
@ -956,16 +925,6 @@ SelectionDisplay = (function () {
switch(result.overlayID) {
case selectionBox:
mode = "TRANSLATE_XZ";
pickRay = Camera.computePickRay(event.x, event.y);
lastPlaneIntersection = rayPlaneIntersection(pickRay, selectedEntityPropertiesOriginalPosition,
Quat.getFront(lastAvatarOrientation));
if (wantDebug) {
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
print(" event.y:" + event.y);
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
Vec3.print(" originalPosition:", selectedEntityPropertiesOriginalPosition);
}
somethingClicked = true;
break;
default:
@ -976,6 +935,17 @@ SelectionDisplay = (function () {
}
}
if (somethingClicked) {
pickRay = Camera.computePickRay(event.x, event.y);
lastPlaneIntersection = rayPlaneIntersection(pickRay, selectedEntityPropertiesOriginalPosition,
Quat.getFront(lastAvatarOrientation));
if (wantDebug) {
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
Vec3.print(" originalPosition:", selectedEntityPropertiesOriginalPosition);
}
}
// reset everything as intersectable...
// TODO: we could optimize this since some of these were already flipped back
Overlays.editOverlay(selectionBox, { ignoreRayIntersection: false });