From 494740f819eabfcddb28c04e05d73e75d2071574 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 15 Aug 2021 22:09:27 -0400 Subject: [PATCH] Add a "Set Rotation to Zero" button Add a "Set Rotation to Zero" button in properties tab (Spatial section) of the create app. --- .../html/js/entityProperties.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 65e14d7203..82015c6350 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -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 */