-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49f5306
commit 8eeb58c
Showing
6 changed files
with
236 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import createAnnotations from "../modules/createAnnotations"; | ||
|
||
export default function() { | ||
createAnnotations(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const sketch = require("sketch/dom"); | ||
const ui = require("sketch/ui"); | ||
|
||
// Create a group named 'Annotations' from the selected layers | ||
export default function() { | ||
const document = sketch.getSelectedDocument(); | ||
const layers = document.selectedLayers.layers; | ||
|
||
// Display message when no layer is selected | ||
if (layers.length === 0) { | ||
ui.message(`No layers selected.`); | ||
return; | ||
} | ||
|
||
// Find to which parent the group should be attached | ||
let parent = layers[0].parent; | ||
if (!parent) { | ||
parent = sketch.Page.fromNative(layers[0].sketchObject.parentPage()); | ||
} | ||
|
||
// Create the group | ||
const group = new sketch.Group({ | ||
parent: parent, | ||
name: "Annotations", | ||
layers: layers | ||
}); | ||
group.adjustToFit(); | ||
|
||
ui.message(`New 'Annotations' group created from ${layers.length} layers.`); | ||
} |