Display face scale handles only for single entities

This commit is contained in:
David Rowe 2017-07-12 15:30:13 +12:00
parent 850b94220f
commit 2c3cd53f8d

View file

@ -211,7 +211,7 @@
} }
function display(rootEntityID, boundingBox) { function display(rootEntityID, boundingBox, isMultiple) {
var boundingBoxDimensions = boundingBox.dimensions, var boundingBoxDimensions = boundingBox.dimensions,
boundingBoxLocalCenter = boundingBox.localCenter, boundingBoxLocalCenter = boundingBox.localCenter,
i; i;
@ -226,15 +226,23 @@
}); });
// Face scale handles. // Face scale handles.
for (i = 0; i < NUM_FACE_HANDLES; i += 1) { // Only valid for a single entity because for multiple entities, some may be at an angle relative to the root entity
Overlays.editOverlay(faceHandleOverlays[i], { // which would necessitate a (non-existent) shear transform be applied to them when scaling a face of the set.
parentID: rootEntityID, if (!isMultiple) {
localPosition: Vec3.sum(boundingBoxLocalCenter, for (i = 0; i < NUM_FACE_HANDLES; i += 1) {
Vec3.multiplyVbyV(FACE_HANDLE_OVERLAY_AXES[i], Overlays.editOverlay(faceHandleOverlays[i], {
Vec3.sum(boundingBoxDimensions, { x: 0.12, y: 0.12, z: 0.12 }))), parentID: rootEntityID,
localRotation: FACE_HANDLE_OVERLAY_ROTATIONS[i], localPosition: Vec3.sum(boundingBoxLocalCenter,
visible: true Vec3.multiplyVbyV(FACE_HANDLE_OVERLAY_AXES[i],
}); Vec3.sum(boundingBoxDimensions, { x: 0.12, y: 0.12, z: 0.12 }))),
localRotation: FACE_HANDLE_OVERLAY_ROTATIONS[i],
visible: true
});
}
} else {
for (i = 0; i < NUM_FACE_HANDLES; i += 1) {
Overlays.editOverlay(faceHandleOverlays[i], { visible: false });
}
} }
} }
@ -332,6 +340,10 @@
return selection; return selection;
} }
function count() {
return selection.length;
}
function getBoundingBox() { function getBoundingBox() {
var center, var center,
localCenter, localCenter,
@ -478,6 +490,7 @@
return { return {
select: select, select: select,
selection: getSelection, selection: getSelection,
count: count,
rootEntityID: getRootEntityID, rootEntityID: getRootEntityID,
boundingBox: getBoundingBox, boundingBox: getBoundingBox,
getPositionAndOrientation: getPositionAndOrientation, getPositionAndOrientation: getPositionAndOrientation,
@ -916,7 +929,7 @@
} }
startEditing(); startEditing();
if (isScaleWithHandles) { if (isScaleWithHandles) {
handles.display(selection.rootEntityID(), selection.boundingBox()); handles.display(selection.rootEntityID(), selection.boundingBox(), selection.count() > 1);
} }
} }
} else { } else {