Add a "Set Rotation to Zero" button

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:09:27 -04:00 committed by GitHub
parent 0d39eea2a6
commit 494740f819
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1383,7 +1383,8 @@ const GROUPS = [
{
type: "buttons",
buttons: [ { id: "copyRotation", label: "Copy Rotation", className: "secondary", onClick: copyRotationProperty },
{ id: "pasteRotation", label: "Paste Rotation", className: "secondary", onClick: pasteRotationProperty } ],
{ id: "pasteRotation", label: "Paste Rotation", className: "secondary", onClick: pasteRotationProperty },
{ id: "setRotationToZero", label: "Set Rotation to Zero", className: "secondary_red", onClick: setRotationToZeroProperty }],
propertyID: "copyPasteRotation"
},
{
@ -1874,10 +1875,16 @@ function setCopyPastePositionAndRotationAvailability (selectionLength, islocked)
if (selectionLength > 0 && !islocked) {
$('#property-copyPastePosition-button-pastePosition').attr('disabled', false);
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false);
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', false);
if (selectionLength === 1) {
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', false);
} else {
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', true);
}
} else {
$('#property-copyPastePosition-button-pastePosition').attr('disabled', true);
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true);
$('#property-copyPasteRotation-button-pasteRotation').attr('disabled', true);
$('#property-copyPasteRotation-button-setRotationToZero').attr('disabled', true);
}
}
@ -3273,7 +3280,12 @@ function pasteRotationProperty() {
action: "pasteRotation"
}));
}
function setRotationToZeroProperty() {
EventBridge.emitWebEvent(JSON.stringify({
type: "action",
action: "setRotationToZero"
}));
}
/**
* USER DATA FUNCTIONS
*/