[Case 6491] Grabbers stay invisible while rotating (details below).

This fixes the issue where grabbers would re-appear when rotating
the selected object rather than staying hidden.

updateHandles will now take the mode into account when deciding
if the non-light grabber handles should be visible.  This can be
subverted by the user selecting a light source as in line with
the previous behavior.

Adds some debug prints in event handlers guarded by local
wantDebug checks.

Has some minor cleanup changes:
* Remove unused var within updateRotationHandles
* Readability improvement for light check within updateHandles
* Pulled up rotate mode check within updateHandles
* Added grabberCloner visibility flag within updateHandles

Changes Committed:
    modified:   scripts/system/libraries/entitySelectionTool.js
This commit is contained in:
LaShonda Hopper 2017-08-03 17:02:09 -04:00 committed by LaShonda Hopper
parent 15ff4ebecb
commit ae8ae6f6cc

View file

@ -1530,7 +1530,6 @@ SelectionDisplay = (function() {
var rotateHandlesVisible = true; var rotateHandlesVisible = true;
var rotationOverlaysVisible = false; var rotationOverlaysVisible = false;
var translateHandlesVisible = true; var translateHandlesVisible = true;
var stretchHandlesVisible = true;
var selectionBoxVisible = true; var selectionBoxVisible = true;
var isPointLight = false; var isPointLight = false;
@ -1543,11 +1542,9 @@ SelectionDisplay = (function() {
rotationOverlaysVisible = true; rotationOverlaysVisible = true;
rotateHandlesVisible = false; rotateHandlesVisible = false;
translateHandlesVisible = false; translateHandlesVisible = false;
stretchHandlesVisible = false;
selectionBoxVisible = false; selectionBoxVisible = false;
} else if (mode == "TRANSLATE_UP_DOWN" || isPointLight) { } else if (mode == "TRANSLATE_UP_DOWN" || isPointLight) {
rotateHandlesVisible = false; rotateHandlesVisible = false;
stretchHandlesVisible = false;
} else if (mode != "UNKNOWN") { } else if (mode != "UNKNOWN") {
// every other mode is a stretch mode... // every other mode is a stretch mode...
rotateHandlesVisible = false; rotateHandlesVisible = false;
@ -1622,6 +1619,7 @@ SelectionDisplay = (function() {
return; return;
} }
//print( " Triggering updateRotationHandles");
that.updateRotationHandles(); that.updateRotationHandles();
var rotation, dimensions, position, registrationPoint; var rotation, dimensions, position, registrationPoint;
@ -1849,201 +1847,212 @@ SelectionDisplay = (function() {
EdgeFR = Vec3.sum(position, EdgeFR); EdgeFR = Vec3.sum(position, EdgeFR);
EdgeFL = Vec3.sum(position, EdgeFL); EdgeFL = Vec3.sum(position, EdgeFL);
var stretchHandlesVisible = spaceMode == SPACE_LOCAL; var inModeRotate = (mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL");
var extendedStretchHandlesVisible = stretchHandlesVisible && showExtendedStretchHandles; var stretchHandlesVisible = !inModeRotate && (spaceMode == SPACE_LOCAL);
var extendedStretchHandlesVisible = (stretchHandlesVisible && showExtendedStretchHandles);
var cloneHandleVisible = !inModeRotate;
//print(" Set Non-Light Grabbers Visible - Norm: " + stretchHandlesVisible + " Ext: " + extendedStretchHandlesVisible);
var isSingleSelection = (selectionManager.selections.length == 1);
if (selectionManager.selections.length == 1) { if (isSingleSelection) {
var properties = Entities.getEntityProperties(selectionManager.selections[0]); var properties = Entities.getEntityProperties(selectionManager.selections[0]);
if (properties.type == "Light" && properties.isSpotlight) { var isLightSelection = (properties.type == "Light");
if ( isLightSelection ) {
//print(" Light Selection revoking Non-Light Grabbers Visibility!");
stretchHandlesVisible = false; stretchHandlesVisible = false;
extendedStretchHandlesVisible = false; extendedStretchHandlesVisible = false;
cloneHandleVisible = false;
if(properties.isSpotlight) {
//print(" Trying to show all SpotLight related grabbers");
Overlays.editOverlay(grabberSpotLightCenter, {
position: position,
visible: false,
});
Overlays.editOverlay(grabberSpotLightRadius, {
position: NEAR,
rotation: rotation,
visible: true,
});
var distance = (properties.dimensions.z / 2) * Math.sin(properties.cutoff * (Math.PI / 180));
Overlays.editOverlay(grabberSpotLightCenter, { Overlays.editOverlay(grabberSpotLightL, {
position: position, position: EdgeNL,
visible: false, rotation: rotation,
}); visible: true,
Overlays.editOverlay(grabberSpotLightRadius, { });
position: NEAR, Overlays.editOverlay(grabberSpotLightR, {
rotation: rotation, position: EdgeNR,
visible: true, rotation: rotation,
}); visible: true,
var distance = (properties.dimensions.z / 2) * Math.sin(properties.cutoff * (Math.PI / 180)); });
Overlays.editOverlay(grabberSpotLightT, {
position: EdgeTN,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberSpotLightB, {
position: EdgeBN,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberSpotLightCircle, {
position: NEAR,
dimensions: {
x: distance,
y: distance,
z: 1
},
lineWidth: 1.5,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberSpotLightL, { Overlays.editOverlay(grabberSpotLightLineT, {
position: EdgeNL, start: position,
rotation: rotation, end: EdgeTN,
visible: true, visible: true,
}); });
Overlays.editOverlay(grabberSpotLightR, { Overlays.editOverlay(grabberSpotLightLineB, {
position: EdgeNR, start: position,
rotation: rotation, end: EdgeBN,
visible: true, visible: true,
}); });
Overlays.editOverlay(grabberSpotLightT, { Overlays.editOverlay(grabberSpotLightLineR, {
position: EdgeTN, start: position,
rotation: rotation, end: EdgeNR,
visible: true, visible: true,
}); });
Overlays.editOverlay(grabberSpotLightB, { Overlays.editOverlay(grabberSpotLightLineL, {
position: EdgeBN, start: position,
rotation: rotation, end: EdgeNL,
visible: true, visible: true,
}); });
Overlays.editOverlay(grabberSpotLightCircle, {
position: NEAR,
dimensions: {
x: distance,
y: distance,
z: 1
},
lineWidth: 1.5,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberSpotLightLineT, { //print(" Trying to hide all PointLight related grabbers");
start: position, Overlays.editOverlay(grabberPointLightCircleX, {
end: EdgeTN, visible: false
visible: true, });
}); Overlays.editOverlay(grabberPointLightCircleY, {
Overlays.editOverlay(grabberSpotLightLineB, { visible: false
start: position, });
end: EdgeBN, Overlays.editOverlay(grabberPointLightCircleZ, {
visible: true, visible: false
}); });
Overlays.editOverlay(grabberSpotLightLineR, { Overlays.editOverlay(grabberPointLightT, {
start: position, visible: false
end: EdgeNR, });
visible: true, Overlays.editOverlay(grabberPointLightB, {
}); visible: false
Overlays.editOverlay(grabberSpotLightLineL, { });
start: position, Overlays.editOverlay(grabberPointLightL, {
end: EdgeNL, visible: false
visible: true, });
}); Overlays.editOverlay(grabberPointLightR, {
visible: false
});
Overlays.editOverlay(grabberPointLightF, {
visible: false
});
Overlays.editOverlay(grabberPointLightN, {
visible: false
});
} else { //..it's a PointLight
//print(" Trying to show all PointLight related grabbers");
Overlays.editOverlay(grabberPointLightT, {
position: TOP,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightB, {
position: BOTTOM,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightL, {
position: LEFT,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightR, {
position: RIGHT,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightF, {
position: FAR,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightN, {
position: NEAR,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleX, {
position: position,
rotation: Quat.multiply(rotation, Quat.fromPitchYawRollDegrees(0, 90, 0)),
dimensions: {
x: properties.dimensions.z / 2.0,
y: properties.dimensions.z / 2.0,
z: 1
},
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleY, {
position: position,
rotation: Quat.multiply(rotation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
dimensions: {
x: properties.dimensions.z / 2.0,
y: properties.dimensions.z / 2.0,
z: 1
},
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleZ, {
position: position,
rotation: rotation,
dimensions: {
x: properties.dimensions.z / 2.0,
y: properties.dimensions.z / 2.0,
z: 1
},
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleX, { //print(" Trying to hide all SpotLight related grabbers");
visible: false Overlays.editOverlay(grabberSpotLightRadius, {
}); visible: false
Overlays.editOverlay(grabberPointLightCircleY, { });
visible: false Overlays.editOverlay(grabberSpotLightL, {
}); visible: false
Overlays.editOverlay(grabberPointLightCircleZ, { });
visible: false Overlays.editOverlay(grabberSpotLightR, {
}); visible: false
Overlays.editOverlay(grabberPointLightT, { });
visible: false Overlays.editOverlay(grabberSpotLightT, {
}); visible: false
Overlays.editOverlay(grabberPointLightB, { });
visible: false Overlays.editOverlay(grabberSpotLightB, {
}); visible: false
Overlays.editOverlay(grabberPointLightL, { });
visible: false Overlays.editOverlay(grabberSpotLightCircle, {
}); visible: false
Overlays.editOverlay(grabberPointLightR, { });
visible: false Overlays.editOverlay(grabberSpotLightLineL, {
}); visible: false
Overlays.editOverlay(grabberPointLightF, { });
visible: false Overlays.editOverlay(grabberSpotLightLineR, {
}); visible: false
Overlays.editOverlay(grabberPointLightN, { });
visible: false Overlays.editOverlay(grabberSpotLightLineT, {
}); visible: false
} else if (properties.type == "Light" && !properties.isSpotlight) { });
stretchHandlesVisible = false; Overlays.editOverlay(grabberSpotLightLineB, {
extendedStretchHandlesVisible = false; visible: false
Overlays.editOverlay(grabberPointLightT, { });
position: TOP, }
rotation: rotation, } else { //..it's not a light at all
visible: true, //print(" Trying to hide all Light related grabbers");
});
Overlays.editOverlay(grabberPointLightB, {
position: BOTTOM,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightL, {
position: LEFT,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightR, {
position: RIGHT,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightF, {
position: FAR,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightN, {
position: NEAR,
rotation: rotation,
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleX, {
position: position,
rotation: Quat.multiply(rotation, Quat.fromPitchYawRollDegrees(0, 90, 0)),
dimensions: {
x: properties.dimensions.z / 2.0,
y: properties.dimensions.z / 2.0,
z: 1
},
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleY, {
position: position,
rotation: Quat.multiply(rotation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
dimensions: {
x: properties.dimensions.z / 2.0,
y: properties.dimensions.z / 2.0,
z: 1
},
visible: true,
});
Overlays.editOverlay(grabberPointLightCircleZ, {
position: position,
rotation: rotation,
dimensions: {
x: properties.dimensions.z / 2.0,
y: properties.dimensions.z / 2.0,
z: 1
},
visible: true,
});
Overlays.editOverlay(grabberSpotLightRadius, {
visible: false
});
Overlays.editOverlay(grabberSpotLightL, {
visible: false
});
Overlays.editOverlay(grabberSpotLightR, {
visible: false
});
Overlays.editOverlay(grabberSpotLightT, {
visible: false
});
Overlays.editOverlay(grabberSpotLightB, {
visible: false
});
Overlays.editOverlay(grabberSpotLightCircle, {
visible: false
});
Overlays.editOverlay(grabberSpotLightLineL, {
visible: false
});
Overlays.editOverlay(grabberSpotLightLineR, {
visible: false
});
Overlays.editOverlay(grabberSpotLightLineT, {
visible: false
});
Overlays.editOverlay(grabberSpotLightLineB, {
visible: false
});
} else {
Overlays.editOverlay(grabberSpotLightCenter, { Overlays.editOverlay(grabberSpotLightCenter, {
visible: false visible: false
}); });
@ -2106,7 +2115,7 @@ SelectionDisplay = (function() {
visible: false visible: false
}); });
} }
} }//--end of isSingleSelection
@ -2184,7 +2193,7 @@ SelectionDisplay = (function() {
}); });
Overlays.editOverlay(grabberCloner, { Overlays.editOverlay(grabberCloner, {
visible: true, visible: cloneHandleVisible,
rotation: rotation, rotation: rotation,
position: EdgeTR position: EdgeTR
}); });
@ -2195,7 +2204,7 @@ SelectionDisplay = (function() {
position: selectionBoxPosition, position: selectionBoxPosition,
dimensions: dimensions, dimensions: dimensions,
rotation: rotation, rotation: rotation,
visible: !(mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL"), visible: !inModeRotate,
}); });
// Create more selection box overlays if we don't have enough // Create more selection box overlays if we don't have enough
@ -2332,7 +2341,7 @@ SelectionDisplay = (function() {
}); });
Overlays.editOverlay(baseOfEntityProjectionOverlay, { Overlays.editOverlay(baseOfEntityProjectionOverlay, {
visible: mode != "ROTATE_YAW" && mode != "ROTATE_PITCH" && mode != "ROTATE_ROLL", visible: !inModeRotate,
solid: true, solid: true,
position: { position: {
x: selectionManager.worldPosition.x, x: selectionManager.worldPosition.x,
@ -4134,7 +4143,7 @@ SelectionDisplay = (function() {
// FUNCTION: MOUSE PRESS EVENT // FUNCTION: MOUSE PRESS EVENT
that.mousePressEvent = function(event) { that.mousePressEvent = function(event) {
var wantDebug = true; var wantDebug = false;
if ( wantDebug ) { if ( wantDebug ) {
print( "=============== eST::MousePressEvent BEG ======================="); print( "=============== eST::MousePressEvent BEG =======================");
} }
@ -4169,7 +4178,9 @@ SelectionDisplay = (function() {
var tool = grabberTools[result.overlayID]; var tool = grabberTools[result.overlayID];
if (tool) { if (tool) {
print("Intersected with known table tool."); if (wantDebug) {
print("Intersected with known table tool( mode: " + tool.mode + " )");
}
activeTool = tool; activeTool = tool;
mode = tool.mode; mode = tool.mode;
somethingClicked = 'tool'; somethingClicked = 'tool';
@ -4177,10 +4188,14 @@ SelectionDisplay = (function() {
activeTool.onBegin(event); activeTool.onBegin(event);
} }
} else { } else {
print("Intersected with unregistered tool..."); if (wantDebug) {
print("Intersected with unregistered tool...");
}
switch (result.overlayID) { switch (result.overlayID) {
case grabberMoveUp: case grabberMoveUp:
print("grabberMoveUp"); if (wantDebug){
print("grabberMoveUp");
}
mode = "TRANSLATE_UP_DOWN"; mode = "TRANSLATE_UP_DOWN";
somethingClicked = mode; somethingClicked = mode;
@ -4196,7 +4211,9 @@ SelectionDisplay = (function() {
case grabberNEAR: case grabberNEAR:
case grabberEdgeTN: // TODO: maybe this should be TOP+NEAR stretching? case grabberEdgeTN: // TODO: maybe this should be TOP+NEAR stretching?
case grabberEdgeBN: // TODO: maybe this should be BOTTOM+FAR stretching? case grabberEdgeBN: // TODO: maybe this should be BOTTOM+FAR stretching?
print("grabberNear variant"); if(wantDebug){
print("grabberNear variant");
}
mode = "STRETCH_NEAR"; mode = "STRETCH_NEAR";
somethingClicked = mode; somethingClicked = mode;
break; break;
@ -4204,47 +4221,64 @@ SelectionDisplay = (function() {
case grabberFAR: case grabberFAR:
case grabberEdgeTF: // TODO: maybe this should be TOP+FAR stretching? case grabberEdgeTF: // TODO: maybe this should be TOP+FAR stretching?
case grabberEdgeBF: // TODO: maybe this should be BOTTOM+FAR stretching? case grabberEdgeBF: // TODO: maybe this should be BOTTOM+FAR stretching?
print("grabberFar variant"); if(wantDebug){
print("grabberFar variant");
}
mode = "STRETCH_FAR"; mode = "STRETCH_FAR";
somethingClicked = mode; somethingClicked = mode;
break; break;
case grabberTOP: case grabberTOP:
print("grabberTOP"); if(wantDebug){
print("grabberTOP");
}
mode = "STRETCH_TOP"; mode = "STRETCH_TOP";
somethingClicked = mode; somethingClicked = mode;
break; break;
case grabberBOTTOM: case grabberBOTTOM:
print("grabberBOTTOM"); if(wantDebug){
print("grabberBOTTOM");
}
mode = "STRETCH_BOTTOM"; mode = "STRETCH_BOTTOM";
somethingClicked = mode; somethingClicked = mode;
break; break;
case grabberRIGHT: case grabberRIGHT:
case grabberEdgeTR: // TODO: maybe this should be TOP+RIGHT stretching? case grabberEdgeTR: // TODO: maybe this should be TOP+RIGHT stretching?
case grabberEdgeBR: // TODO: maybe this should be BOTTOM+RIGHT stretching? case grabberEdgeBR: // TODO: maybe this should be BOTTOM+RIGHT stretching?
print("grabberRight variant"); if(wantDebug){
print("grabberRight variant");
}
mode = "STRETCH_RIGHT"; mode = "STRETCH_RIGHT";
somethingClicked = mode; somethingClicked = mode;
break; break;
case grabberLEFT: case grabberLEFT:
case grabberEdgeTL: // TODO: maybe this should be TOP+LEFT stretching? case grabberEdgeTL: // TODO: maybe this should be TOP+LEFT stretching?
case grabberEdgeBL: // TODO: maybe this should be BOTTOM+LEFT stretching? case grabberEdgeBL: // TODO: maybe this should be BOTTOM+LEFT stretching?
print("grabberLeft variant"); if(wantDebug){
print("grabberLeft variant");
}
mode = "STRETCH_LEFT"; mode = "STRETCH_LEFT";
somethingClicked = mode; somethingClicked = mode;
break; break;
default: default:
print("UNKNOWN( " + result.overlayID + " )"); if(wantDebug){
print("UNKNOWN( " + result.overlayID + " )");
}
mode = "UNKNOWN"; mode = "UNKNOWN";
break; break;
} }
if(wantDebug){
print(" Unregistered Tool Mode: " + mode );
}
} }
} }
// if one of the items above was clicked, then we know we are in translate or stretch mode, and we // if one of the items above was clicked, then we know we are in translate or stretch mode, and we
// should hide our rotate handles... // should hide our rotate handles...
if (somethingClicked) { if (somethingClicked) {
print("Click is triggering hiding of handles, hopefully"); if(wantDebug){
print(" Trying to hide PitchYawRoll Handles");
}
Overlays.editOverlay(yawHandle, { Overlays.editOverlay(yawHandle, {
visible: false visible: false
}); });
@ -4256,6 +4290,9 @@ SelectionDisplay = (function() {
}); });
if (mode != "TRANSLATE_UP_DOWN") { if (mode != "TRANSLATE_UP_DOWN") {
if(wantDebug){
print(" Trying to hide GrabberMoveUp");
}
Overlays.editOverlay(grabberMoveUp, { Overlays.editOverlay(grabberMoveUp, {
visible: false visible: false
}); });
@ -4287,30 +4324,46 @@ SelectionDisplay = (function() {
originalRoll = roll; originalRoll = roll;
if (result.intersects) { if (result.intersects) {
print("Intersection detected with handle...");
var resultTool = grabberTools[result.overlayID]; var resultTool = grabberTools[result.overlayID];
if(wantDebug){
print("Intersection detected with handle...");
}
if (resultTool) { if (resultTool) {
if(wantDebug){
print(" " + resultTool.mode);
}
activeTool = resultTool; activeTool = resultTool;
mode = resultTool.mode; mode = resultTool.mode;
somethingClicked = 'tool'; somethingClicked = 'tool';
if (activeTool && activeTool.onBegin) { if (activeTool && activeTool.onBegin) {
if(wantDebug){
print(" Triggering Tool's onBegin");
}
activeTool.onBegin(event); activeTool.onBegin(event);
} else if(wantDebug) {
print(" Tool's missing onBegin");
} }
} }
switch (result.overlayID) { switch (result.overlayID) {
case yawHandle: case yawHandle:
print("Handle_YAW"); if(wantDebug){
print("Handle_YAW");
}
mode = "ROTATE_YAW"; mode = "ROTATE_YAW";
somethingClicked = mode; somethingClicked = mode;
overlayOrientation = yawHandleRotation; overlayOrientation = yawHandleRotation;
overlayCenter = yawCenter; overlayCenter = yawCenter;
yawZero = result.intersection; yawZero = result.intersection;
rotationNormal = yawNormal; rotationNormal = yawNormal;
print("rotationNormal set to: " + rotationNormal.x + ", " + rotationNormal.y + ", " + rotationNormal.z); if(wantDebug){
print("rotationNormal set to: " + rotationNormal.x + ", " + rotationNormal.y + ", " + rotationNormal.z);
}
break; break;
case pitchHandle: case pitchHandle:
print("Handle_PITCH"); if(wantDebug){
print("Handle_PITCH");
}
mode = "ROTATE_PITCH"; mode = "ROTATE_PITCH";
initialPosition = SelectionManager.worldPosition; initialPosition = SelectionManager.worldPosition;
somethingClicked = mode; somethingClicked = mode;
@ -4318,18 +4371,24 @@ SelectionDisplay = (function() {
overlayCenter = pitchCenter; overlayCenter = pitchCenter;
pitchZero = result.intersection; pitchZero = result.intersection;
rotationNormal = pitchNormal; rotationNormal = pitchNormal;
print("rotationNormal set to: " + rotationNormal.x + ", " + rotationNormal.y + ", " + rotationNormal.z); if(wantDebug){
print("rotationNormal set to: " + rotationNormal.x + ", " + rotationNormal.y + ", " + rotationNormal.z);
}
break; break;
case rollHandle: case rollHandle:
print("Handle_ROLL"); if(wantDebug){
print("Handle_ROLL");
}
mode = "ROTATE_ROLL"; mode = "ROTATE_ROLL";
somethingClicked = mode; somethingClicked = mode;
overlayOrientation = rollHandleRotation; overlayOrientation = rollHandleRotation;
overlayCenter = rollCenter; overlayCenter = rollCenter;
rollZero = result.intersection; rollZero = result.intersection;
rotationNormal = rollNormal; rotationNormal = rollNormal;
print("rotationNormal set to: " + rotationNormal.x + ", " + rotationNormal.y + ", " + rotationNormal.z); if(wantDebug){
print("rotationNormal set to: " + rotationNormal.x + ", " + rotationNormal.y + ", " + rotationNormal.z);
}
break; break;
default: default:
@ -4347,6 +4406,9 @@ SelectionDisplay = (function() {
if (somethingClicked) { if (somethingClicked) {
if(wantDebug){
print(" Trying to show rotateOverlay Handles");
}
Overlays.editOverlay(rotateOverlayTarget, { Overlays.editOverlay(rotateOverlayTarget, {
visible: true, visible: true,
rotation: overlayOrientation, rotation: overlayOrientation,
@ -4371,6 +4433,9 @@ SelectionDisplay = (function() {
startAt: 0, startAt: 0,
endAt: 0 endAt: 0
}); });
if(wantDebug){
print(" Trying to hide PitchYawRoll Handles");
}
Overlays.editOverlay(yawHandle, { Overlays.editOverlay(yawHandle, {
visible: false visible: false
}); });
@ -4381,15 +4446,11 @@ SelectionDisplay = (function() {
visible: false visible: false
}); });
if(wantDebug){
print(" Trying to hide Non-Light GrabberHandles");
}
// TODO: these three duplicate prior three, remove them. Overlays.editOverlay(grabberCloner, {
Overlays.editOverlay(yawHandle, {
visible: false
});
Overlays.editOverlay(pitchHandle, {
visible: false
});
Overlays.editOverlay(rollHandle, {
visible: false visible: false
}); });
Overlays.editOverlay(grabberMoveUp, { Overlays.editOverlay(grabberMoveUp, {
@ -4485,6 +4546,9 @@ SelectionDisplay = (function() {
switch (result.overlayID) { switch (result.overlayID) {
case selectionBox: case selectionBox:
activeTool = translateXZTool; activeTool = translateXZTool;
if(wantDebug){
print("Clicked selectionBox, Activating Tool: " + activeTool.mode );
}
translateXZTool.pickPlanePosition = result.intersection; translateXZTool.pickPlanePosition = result.intersection;
translateXZTool.greatestDimension = Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y), translateXZTool.greatestDimension = Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y),
SelectionManager.worldDimensions.z); SelectionManager.worldDimensions.z);
@ -4518,7 +4582,10 @@ SelectionDisplay = (function() {
} }
// reset everything as intersectable... // reset everything as intersectable...
// TODO: we could optimize this since some of these were already flipped back // TODO: we could optimize this since some of these were already flipped back(i.e: just get rid of this)
if(wantDebug){
print("Trying to set SelectionBox & PitchYawRoll Handles to NOT_IGNORE Rays");
}
Overlays.editOverlay(selectionBox, { Overlays.editOverlay(selectionBox, {
ignoreRayIntersection: false ignoreRayIntersection: false
}); });
@ -4541,9 +4608,25 @@ SelectionDisplay = (function() {
// FUNCTION: MOUSE MOVE EVENT // FUNCTION: MOUSE MOVE EVENT
that.mouseMoveEvent = function(event) { that.mouseMoveEvent = function(event) {
var wantDebug = false;
if(wantDebug){
print( "=============== eST::MouseMoveEvent BEG =======================");
}
if (activeTool) { if (activeTool) {
if(wantDebug){
print(" Trigger ActiveTool( " + activeTool.mode + " )'s onMove");
}
activeTool.onMove(event); activeTool.onMove(event);
if(wantDebug){
print(" Trigger SelectionManager::update");
}
SelectionManager._update(); SelectionManager._update();
if(wantDebug){
print( "=============== eST::MouseMoveEvent END =======================");
}
//--EARLY EXIT--( Move handled via active tool)
return true; return true;
} }
@ -4666,6 +4749,9 @@ SelectionDisplay = (function() {
} }
} }
if(wantDebug){
print("=============== eST::MouseMoveEvent END =======================");
}
return false; return false;
}; };
@ -4710,13 +4796,27 @@ SelectionDisplay = (function() {
// FUNCTION: MOUSE RELEASE EVENT // FUNCTION: MOUSE RELEASE EVENT
that.mouseReleaseEvent = function(event) { that.mouseReleaseEvent = function(event) {
var showHandles = false; var wantDebug = false;
if (activeTool && activeTool.onEnd) { if(wantDebug){
activeTool.onEnd(event); print("=============== eST::MouseReleaseEvent BEG =======================");
} }
activeTool = null; var showHandles = false;
if (activeTool) {
if( activeTool.onEnd ) {
if(wantDebug){
print(" Triggering ActiveTool( " + activeTool.mode + " )'s onEnd");
}
activeTool.onEnd(event);
}else if(wantDebug){
print(" ActiveTool( " + activeTool.mode + " )'s missing onEnd");
}
}
// hide our rotation overlays..., and show our handles // hide our rotation overlays..., and show our handles
if (mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL") { if (mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL") {
if(wantDebug){
print(" Triggering hide of RotateOverlays");
}
Overlays.editOverlay(rotateOverlayTarget, { Overlays.editOverlay(rotateOverlayTarget, {
visible: false visible: false
}); });
@ -4729,22 +4829,26 @@ SelectionDisplay = (function() {
Overlays.editOverlay(rotateOverlayCurrent, { Overlays.editOverlay(rotateOverlayCurrent, {
visible: false visible: false
}); });
showHandles = true;
}
if (mode != "UNKNOWN") {
showHandles = true;
} }
showHandles = (mode != "UNKNOWN");//<base on prior mode
mode = "UNKNOWN"; mode = "UNKNOWN";
activeTool = null;
// if something is selected, then reset the "original" properties for any potential next click+move operation // if something is selected, then reset the "original" properties for any potential next click+move operation
if (SelectionManager.hasSelection()) { if (SelectionManager.hasSelection()) {
if (showHandles) { if (showHandles) {
if(wantDebug){
print(" Triggering that.select");
}
that.select(SelectionManager.selections[0], event); that.select(SelectionManager.selections[0], event);
} }
} }
if(wantDebug){
print("=============== eST::MouseReleaseEvent END =======================");
}
}; };
// NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these: // NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these: