Update App.tsx and ViewportHost.ts with axis constraint space and message updates
This commit is contained in:
@@ -2062,7 +2062,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
||||
setStatusMessage(
|
||||
`${getTransformOperationLabel(operation)} ${getTransformTargetLabel(transformTarget).toLowerCase()} in ${getViewportPanelLabel(
|
||||
transformSourcePanelId
|
||||
)}. Move the pointer, press X/Y/Z to constrain, click or press Enter to commit, Escape cancels.`
|
||||
)}. Move the pointer, press X/Y/Z to constrain, press the same axis again for local when supported, click or press Enter to commit, Escape cancels.`
|
||||
);
|
||||
};
|
||||
|
||||
@@ -3211,7 +3211,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
||||
setStatusMessage(
|
||||
`Move ${getTransformTargetLabel(transformTarget).toLowerCase()} in ${getViewportPanelLabel(
|
||||
transformSourcePanelId
|
||||
)}. Move the pointer, press X/Y/Z to constrain, click or press Enter to commit, Escape cancels.`
|
||||
)}. Move the pointer, press X/Y/Z to constrain, press the same axis again for local when supported, click or press Enter to commit, Escape cancels.`
|
||||
);
|
||||
} else {
|
||||
setStatusMessage("Duplicated selection.");
|
||||
|
||||
@@ -1498,6 +1498,7 @@ export class ViewportHost {
|
||||
sourcePanelId: this.panelId,
|
||||
operation: "translate",
|
||||
axisConstraint: null,
|
||||
axisConstraintSpace: "world",
|
||||
target: transformTarget,
|
||||
preview: createTransformPreviewFromTarget(transformTarget)
|
||||
};
|
||||
@@ -1835,10 +1836,7 @@ export class ViewportHost {
|
||||
|
||||
if (axisConstraint !== null) {
|
||||
const initialOrientation = this.createRotationQuaternion(session.target.initialRotationDegrees);
|
||||
const deltaRotation = new Quaternion().setFromAxisAngle(
|
||||
this.getConstraintAxisWorldVector(session, effectiveAxis, axisConstraintSpace),
|
||||
pointerDeltaRadians
|
||||
);
|
||||
const deltaRotation = new Quaternion().setFromAxisAngle(this.axisVector(effectiveAxis), pointerDeltaRadians);
|
||||
|
||||
nextRotationDegrees = this.getQuaternionEulerDegrees(
|
||||
axisConstraintSpace === "local" && supportsLocalTransformAxisConstraint(session, effectiveAxis)
|
||||
@@ -1869,10 +1867,7 @@ export class ViewportHost {
|
||||
|
||||
if (axisConstraint !== null) {
|
||||
const initialOrientation = this.createRotationQuaternion(session.target.initialRotationDegrees);
|
||||
const deltaRotation = new Quaternion().setFromAxisAngle(
|
||||
this.getConstraintAxisWorldVector(session, effectiveAxis, axisConstraintSpace),
|
||||
pointerDeltaRadians
|
||||
);
|
||||
const deltaRotation = new Quaternion().setFromAxisAngle(this.axisVector(effectiveAxis), pointerDeltaRadians);
|
||||
|
||||
nextRotationDegrees = this.getQuaternionEulerDegrees(
|
||||
axisConstraintSpace === "local" && supportsLocalTransformAxisConstraint(session, effectiveAxis)
|
||||
@@ -1942,10 +1937,7 @@ export class ViewportHost {
|
||||
session.target.initialRotation.direction.z
|
||||
).normalize()
|
||||
);
|
||||
const deltaRotation = new Quaternion().setFromAxisAngle(
|
||||
this.getConstraintAxisWorldVector(session, effectiveAxis, axisConstraintSpace),
|
||||
pointerDeltaRadians
|
||||
);
|
||||
const deltaRotation = new Quaternion().setFromAxisAngle(this.axisVector(effectiveAxis), pointerDeltaRadians);
|
||||
const nextOrientation =
|
||||
axisConstraint !== null && axisConstraintSpace === "local" && supportsLocalTransformAxisConstraint(session, effectiveAxis)
|
||||
? initialOrientation.multiply(deltaRotation)
|
||||
|
||||
Reference in New Issue
Block a user