diff --git a/src/artboard-manager.js b/src/artboard-manager.js index 05a76ba..59a36a8 100644 --- a/src/artboard-manager.js +++ b/src/artboard-manager.js @@ -94,17 +94,20 @@ export function InsertArtboard(context){ } } -export function ToggleAutoMode(){ +export function ToggleAutoMode(context){ let autoMode = Settings.settingForKey("autoMode") Settings.setSettingForKey("autoMode", !autoMode) + autoMode = Settings.settingForKey("autoMode") checkMarkMenu() - UI.message(`Artboard Manager: Auto Mode ${Settings.settingForKey("autoMode") ? "enabled" : "disabled"}`) + UI.message(`Artboard Manager: Auto Mode ${autoMode ? "enabled" : "disabled"}`) + if (autoMode) { + // console.log('Auto Mode is enabled, so lets arrange the Artboards') + ArrangeArtboards(context) + } } export function ArrangeArtboards(context) { - if (!config.autoMode) { - return - } + if (Settings.settingForKey("autoMode") == false) { return } const doc = sketch.getSelectedDocument() const page = doc.selectedPage const symbolsPage = doc._object.documentData().symbolsPage() @@ -198,7 +201,7 @@ export function ArrangeArtboards(context) { // Restore original selection originalSelection.forEach(artboard => artboard.selected = true) - console.log('Artboards arranged') + // console.log('Artboards arranged') } function snapValueToGrid(value, grid) { diff --git a/src/artboard-settings.js b/src/artboard-settings.js index ed9f535..40d5fe9 100644 --- a/src/artboard-settings.js +++ b/src/artboard-settings.js @@ -32,7 +32,7 @@ export function ArtboardSettings(context) { const options = { identifier: "artboardManagerSettings", width: 350, - height: 306, + height: 280, show: false, resizable: false, title: "Artboard Manager — Settings", diff --git a/src/manifest.json b/src/manifest.json index fa6bad4..5ecfaf9 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -15,7 +15,6 @@ "Duplicate.finish": "Duplicate", "HandlerLostFocus": "Resize", "ResizeArtboardToFit": "ResizeArtboardToFit", - "InsertArtboard.finish": "InsertArtboard", "onDocumentChanged": "onDocumentChanged" } },