Skip to content

Commit 4a61465

Browse files
committed
Update Fit to Width.sketchplugin
1 parent c555e92 commit 4a61465

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Fit to Width.sketchplugin

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// Fit to Width (cmd shift 1)
22
// This plugin will zoom out to fit the canvas' contents in the window,
33
// but maximizing the width only
4-
margin = 50
5-
view = [doc currentView]
6-
7-
window_width = view.frame().size.width
8-
window_height = view.frame().size.height
9-
10-
layers = doc.currentPage().containedLayers()
11-
layerRect = [view totalRectForLayers:layers]
4+
var doc = context.document,
5+
margin = 50,
6+
view = [doc currentView],
7+
window_width = view.frame().size.width,
8+
window_height = view.frame().size.height,
9+
layers = doc.currentPage().containedLayers(),
10+
layerRect = [view totalRectForLayers:layers]
1211

1312
// Calculate vertical ratio
14-
ratio = window_width / window_height
13+
var ratio = window_width / window_height
1514

1615
// Set rect height to new ratio
1716
layerRect.size.height = layerRect.size.width / ratio

0 commit comments

Comments
 (0)