// React to transform related changes
// Uses: type, parent, pixelscale, size, offset, ortho, locationOrtho, stack
if ((changeMask & (CHANGED_TYPE | CHANGED_PARENT | CHANGED_PIXEL_SCALE | CHANGED_SIZE_APP |
CHANGED_OFFSET | CHANGED_ORTHO | CHANGED_LOCATION_ORTHO | CHANGED_STACK)) != 0) {
CellTransform transform = null;
switch (type) {
case UNKNOWN:
case PRIMARY:
transform = new CellTransform(null, null);
if (ortho) {
Vector3f orthoLocTranslation = new Vector3f();
orthoLocTranslation.x = locationOrtho.x;
orthoLocTranslation.y = locationOrtho.y;
transform.setTranslation(orthoLocTranslation);
} else {
// Note: primaries now also honor the offset.
// Uses: type, parent, pixelScale, size, offset, ortho
transform = calcOffsetStackTransform();
}
break;
case SECONDARY:
case POPUP:
// Uses: type, parent, pixelScale, size, offset, ortho
transform = calcOffsetStackTransform();
}
sgChangeGeometryTransformOffsetStackSet(geometryNode, transform);
}
// Update the view node's user transform, if necessary
// Uses: type, deltaTranslationToApply
if ((changeMask & (CHANGED_TYPE | CHANGED_USER_TRANSFORM | CHANGED_ORTHO)) != 0) {
// Select the current user transform based on the ortho mode
CellTransform currentUserTransform;
if (ortho) {
currentUserTransform = userTransformOrtho;
} else {
currentUserTransform = userTransformCell;
}
if (!userTransformCellReplaced) {
// Apply any pending user transform deltas (by post-multiplying them
// into the current user transform
logger.fine("currentUserTransform (before) = " + currentUserTransform);
userTransformApplyDeltas(currentUserTransform);
}
logger.fine("currentUserTransform (latest) = " + currentUserTransform);
// Now put the update user transformation into effect
switch (type) {
case UNKNOWN:
case PRIMARY:
updatePrimaryTransform(currentUserTransform);
break;
case SECONDARY:
sgChangeTransformUserSet(viewNode, currentUserTransform);
// Note: moving a secondary in the cell doesn't change the position
// of the secondary in ortho, and vice versa.
if (!ortho && !userTransformCellChangedLocalOnly) {
window.changedUserTransformCell(userTransformCell, this);
}
break;
case POPUP:
// Always set to identity
sgChangeTransformUserSet(viewNode, new CellTransform(null, null));
}
userTransformCellReplaced = false;
userTransformCellChangedLocalOnly = false;
}