├── .DS_Store
├── NudgitShapes.sketchplugin
└── Contents
│ └── Sketch
│ ├── manifest.json
│ ├── nearest-height.cocoascript
│ └── nearest-width.cocoascript
└── README.md
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/acollurafici/Sketch-Nearest-8/7201ff28203034d101ec910e0bc7ad79b2573562/.DS_Store
--------------------------------------------------------------------------------
/NudgitShapes.sketchplugin/Contents/Sketch/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "author" : "Anthony Collurafici",
3 | "commands" : [
4 | {
5 | "script" : "nearest-height.cocoascript",
6 | "handeler": "onRun",
7 | "shortcut" : "cmd ctrl 8",
8 | "name" : "Nearest Height",
9 | "identifier" : "nearestheight"
10 | },{
11 | "script" : "nearest-width.cocoascript",
12 | "handeler": "onRun",
13 | "shortcut" : "cmd 8",
14 | "name" : "Nearest Width",
15 | "identifier" : "nearestwidth"
16 | }
17 | ],
18 | "menu" : {
19 | "title" : "Sketch Nearest 8",
20 | "items": [
21 | "nearestheight",
22 | "nearestwidth"
23 | ]
24 | },
25 | "identifier" : "com.example.sketch.nudgitshapes",
26 | "version" : "1.1",
27 | "description" : "",
28 | "authorEmail" : "acollurafici@gmail.com",
29 | "name" : "Sketch Nearest 8",
30 | "homepage": "http://www.checkyourvector.com"
31 | }
--------------------------------------------------------------------------------
/NudgitShapes.sketchplugin/Contents/Sketch/nearest-height.cocoascript:
--------------------------------------------------------------------------------
1 | // Increase Height (ctrl e)
2 | /*
3 | Author: Anthony Collurafici
4 | Date: October 2015
5 | Version: 0.1
6 |
7 | */
8 |
9 | var onRun = function (context) {
10 | var selection = context.selection,
11 | doc = context.document,
12 | layer = selection[0],
13 | frame = [layer frame],
14 | width = [frame width],
15 | height = [frame height];
16 |
17 | if (height % 8 === 0) {
18 | log("true");
19 | height = height + 8;
20 | } else {
21 | log("false");
22 | height = Math.ceil(height/8.0) * 8;
23 | }
24 |
25 |
26 | [[layer frame] setHeight: (height)]
27 | [doc showMessage: "Height: " + height];
28 | log(height);
29 | context.document.reloadInspector()
30 | }
31 |
--------------------------------------------------------------------------------
/NudgitShapes.sketchplugin/Contents/Sketch/nearest-width.cocoascript:
--------------------------------------------------------------------------------
1 | // Increase Width (ctrl w)
2 | /*
3 | Author: Anthony Collurafici
4 | Date: October 2015
5 | Version: 0.1
6 |
7 | */
8 |
9 | var onRun = function (context) {
10 | var selection = context.selection,
11 | doc = context.document,
12 | layer = selection[0],
13 | frame = [layer frame],
14 | width = [frame width],
15 | height = [frame height];
16 |
17 | if (width % 8 === 0) {
18 | log("true");
19 | width = width + 8;
20 | } else {
21 | log("false");
22 | width = Math.ceil(width/8.0) * 8;
23 | }
24 |
25 |
26 | [[layer frame] setWidth: (width)]
27 | [doc showMessage: "Width: " + width];
28 | log(width);
29 | context.document.reloadInspector()
30 | }
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sketch-Nearest-8
2 | Sketch Plugin to round shape size to the nearest multiple of 8
3 |
4 | Select Shape
5 | (crtl + W) Round shape Width to the nearest multiple of 8.
6 | (crtl + E) Round shape Height to the nearest multiple of 8.
7 |
8 | Continue pressing the shortcut to increase by 8px increments.
9 |
--------------------------------------------------------------------------------