Skip to content

Commit

Permalink
added align to pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Hrescak committed Mar 16, 2015
1 parent 0a809bf commit b0b922d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Align to Pixel.sketchplugin
@@ -0,0 +1,10 @@
// snaps currently selected layer or group on whole pixel value (cmd shift ')

var loop = [selection objectEnumerator]
while (layer = [loop nextObject]) {
roundedY = Math.round(layer.frame().y());
layer.frame().y = roundedY;

roundedX = Math.round(layer.frame().x());
layer.frame().x = roundedX;
}
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -5,3 +5,4 @@ a box for random sketch plugins

- **Toggle Specs** (cmd+L) toggles visibility of all of the layer groups in your document named "specs". Other than specs this could be useful with hidden guides.
- **Select Parent Artboards** (cmd+shift+A) selects artboards that contain currently selected layers or groups. You can just draw a selection rectangle and hit the shortcut instead of selecting artboards one by one. Useful for moving many artboards around at once.
- **Align to Pixel** (cmd+shift+’) aligns the selected layer or group to whole pixels by rounding the x and y values.

0 comments on commit b0b922d

Please sign in to comment.