Skip to content

Commit 1fab41e

Browse files
committed
Update docs for mouse resizing in layouts
1 parent 94f5d3c commit 1fab41e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/custom-layouts.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ A function that takes two arguments—`change` and `state`—and must return a n
5656

5757
A function that takes two arguments—`ratio` and `state`—and must return a new layout state based on the recommended ratio.
5858

59-
* `ratio`: the ratio recommended for the layout based on windows being resized by mouse controls
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.
6068

6169
### Common Structures
6270

@@ -70,12 +78,14 @@ A window is an object with three properties.
7078

7179
#### Frames
7280

73-
A frame is an object with four properties.
81+
A frame is an object with four required properties and two optional properties.
7482

7583
* `x`: x-coordinate in the screen space
7684
* `y`: y-coordinate in the screen space
7785
* `width`: pixel width
7886
* `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`)
7989

8090
Note that frames are in a global space, not relative to a given screen.
8191

0 commit comments

Comments
 (0)