Add "Set Rotation to Zero"

Add a "Set Rotation to Zero" button
in properties tab (Spatial section)
of the create app.
This commit is contained in:
Alezia Kurdis 2021-08-15 22:08:46 -04:00 committed by GitHub
parent 1122156d3a
commit 0d39eea2a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2656,6 +2656,24 @@ var PropertiesTool = function (opts) {
} else {
audioFeedback.rejection();
}
} else if (data.action === "setRotationToZero") {
if (selectionManager.selections.length === 1 && SelectionManager.hasUnlockedSelection()) {
selectionManager.saveProperties();
var parentState = getParentState(selectionManager.selections[0]);
if ((parentState === "PARENT_CHILDREN" || parentState === "CHILDREN") && selectionDisplay.getSpaceMode() === "local" ) {
Entities.editEntity(selectionManager.selections[0], {
localRotation: Quat.IDENTITY
});
} else {
Entities.editEntity(selectionManager.selections[0], {
rotation: Quat.IDENTITY
});
}
pushCommandForSelections();
selectionManager._update(false, this);
} else {
audioFeedback.rejection();
}
}
} else if (data.type === "propertiesPageReady") {
updateSelections(true);