mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:27:04 +02:00
Safeguard code for Copy/Paste Position/Rotation
Safeguard code for Copy/Paste Position/Rotation The 4 actions has now validations to avoid to only have those validation on the UI. Making sure there is a single selection to execute these actions: Copy Position Copy Rotation Making sure there is a selection that doesn't contain locked entity and that we have a copied value in order to execute these actions: Paste Location Paste Rotation
This commit is contained in:
parent
cf66d1aca3
commit
a4483e6367
1 changed files with 15 additions and 15 deletions
|
@ -2617,19 +2617,21 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data.action === "copyPosition") {
|
} else if (data.action === "copyPosition") {
|
||||||
selectionManager.saveProperties();
|
if (selectionManager.selections.length === 1) {
|
||||||
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
selectionManager.saveProperties();
|
||||||
copiedPosition = properties.position;
|
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
||||||
Window.copyToClipboard(JSON.stringify(copiedPosition));
|
copiedPosition = properties.position;
|
||||||
print("COPIED: " + JSON.stringify(copiedPosition));
|
Window.copyToClipboard(JSON.stringify(copiedPosition));
|
||||||
|
}
|
||||||
} else if (data.action === "copyRotation") {
|
} else if (data.action === "copyRotation") {
|
||||||
selectionManager.saveProperties();
|
if (selectionManager.selections.length === 1) {
|
||||||
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
selectionManager.saveProperties();
|
||||||
copiedRotation = properties.rotation;
|
properties = selectionManager.savedProperties[selectionManager.selections[0]];
|
||||||
Window.copyToClipboard(JSON.stringify(copiedRotation));
|
copiedRotation = properties.rotation;
|
||||||
print("COPIED: " + JSON.stringify(copiedRotation));
|
Window.copyToClipboard(JSON.stringify(copiedRotation));
|
||||||
|
}
|
||||||
} else if (data.action === "pastePosition") {
|
} else if (data.action === "pastePosition") {
|
||||||
if (copiedPosition !== undefined) {
|
if (copiedPosition !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
for (i = 0; i < selectionManager.selections.length; i++) {
|
for (i = 0; i < selectionManager.selections.length; i++) {
|
||||||
Entities.editEntity(selectionManager.selections[i], {
|
Entities.editEntity(selectionManager.selections[i], {
|
||||||
|
@ -2638,12 +2640,11 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update(false, this);
|
selectionManager._update(false, this);
|
||||||
print("PASTE POSITION");
|
|
||||||
} else {
|
} else {
|
||||||
audioFeedback.rejection();
|
audioFeedback.rejection();
|
||||||
}
|
}
|
||||||
} else if (data.action === "pasteRotation") {
|
} else if (data.action === "pasteRotation") {
|
||||||
if (copiedRotation !== undefined) {
|
if (copiedRotation !== undefined && selectionManager.selections.length > 0 && SelectionManager.hasUnlockedSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
for (i = 0; i < selectionManager.selections.length; i++) {
|
for (i = 0; i < selectionManager.selections.length; i++) {
|
||||||
Entities.editEntity(selectionManager.selections[i], {
|
Entities.editEntity(selectionManager.selections[i], {
|
||||||
|
@ -2651,8 +2652,7 @@ var PropertiesTool = function (opts) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update(false, this);
|
selectionManager._update(false, this);
|
||||||
print("PASTE ROTATION");
|
|
||||||
} else {
|
} else {
|
||||||
audioFeedback.rejection();
|
audioFeedback.rejection();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue