File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
// Fit to Width (cmd shift 1)
2
+ // This plugin will zoom out to fit the canvas' contents in the window,
3
+ // but maximizing the width only
2
4
margin = 50
3
5
view = [doc currentView]
4
6
@@ -12,11 +14,11 @@ layerRect = [view totalRectForLayers:layers]
12
14
ratio = window_width / window_height
13
15
14
16
// Set rect height to new ratio
15
- layerRect.setHeight( layerRect.width() / ratio)
17
+ layerRect.size.height = layerRect.size. width / ratio
16
18
17
- layerRect.setX(layerRect.x() - margin)
18
- layerRect.setY(layerRect.y() - margin)
19
- layerRect.setWidth(layerRect .width() + margin*2)
20
- layerRect.setHeight(layerRect .height() + margin*2)
19
+ layerRect.origin.x -= margin
20
+ layerRect.origin.y -= margin
21
+ layerRect.size .width += margin*2
22
+ layerRect.size .height += margin*2
21
23
22
24
[view zoomToFitRect:layerRect]
You can’t perform that action at this time.
0 commit comments