You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/custom-layouts.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,20 @@ A function that takes two arguments—`change` and `state`—and must return a n
52
52
53
53
*`change`: the particular change the layout needs to respond to.
54
54
55
+
#### `recommendMainPaneRatio`
56
+
57
+
A function that takes two arguments—`ratio` and `state`—and must return a new layout state based on the recommended ratio.
58
+
59
+
*`ratio`: the ratio recommended for the layout based on windows being resized by mouse controls.
60
+
61
+
### Mouse Resizing
62
+
63
+
Amethyst supports changing the relative ratios of windows when changing the size of windows by dragging them with the cursor. By default, these ratios are recommended by calling the `recommendMainPaneRatio` layout property, and happen on the horizontal axis. When the window is resized, the system determines what ratio is appropriate for the new width given the dimensions of the screen it is on. These values are clamped to [0, 1].
64
+
65
+
To scale along a different axis, you can specify the `unconstrainedDimension` and `isMain` properties of each window's frame. The dimension determines the axis along which window frame changes will cause recommended ratio changes, and the `isMain` property determines which part of the ratio the window applies to.
66
+
67
+
Note that currently the recommended ratio is global to the layout and not specific to a given window, so it is not particularly meaningful to specify multiple `unconstrainedDimension` values among frames.
68
+
55
69
### Common Structures
56
70
57
71
#### Windows
@@ -64,12 +78,14 @@ A window is an object with three properties.
64
78
65
79
#### Frames
66
80
67
-
A frame is an object with four properties.
81
+
A frame is an object with four required properties and two optional properties.
68
82
69
83
*`x`: x-coordinate in the screen space
70
84
*`y`: y-coordinate in the screen space
71
85
*`width`: pixel width
72
86
*`height`: pixel height
87
+
* (optional) `isMain`: boolean indicating whether the window is in the main pane (default: `true`)
88
+
* (optional) `unconstrainedDimension`: a string indicating on which axis the window is able to be resized via mouse (values: `horizontal`, `vertical`; default: `horizontal`)
73
89
74
90
Note that frames are in a global space, not relative to a given screen.
0 commit comments