-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathmain.js
32 lines (30 loc) · 895 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const getScaleDialog = require("./functions/getScaleDialog");
const {
showSelectedNoedsLengthError,
showRootNodeContextError,
} = require("./functions/utilities");
async function showScaleDialog(selection) {
// Error
if (selection.items.length !== 1 && selection.items.length !== 2) {
showSelectedNoedsLengthError();
return false;
}
// Error2
if (selection.items[0].parent.constructor.name === "RootNode") {
showRootNodeContextError();
return false;
}
// Get and show the dialog
const dialog = getScaleDialog(selection);
const result = await dialog.showModal();
// Exit if the user cancels the modal
if (result === "reasonCanceled")
console.log("[LOG] The user canncel or escape the menu");
// Exit on user completion of task
return console.log("[LOG] Operation finished");
}
module.exports = {
commands: {
run: showScaleDialog,
},
};