1
0
Fork 0

chore(markdown): Updated settings docs for v3

This commit is contained in:
Joost De Cock 2022-10-02 17:41:04 +02:00
parent d988f11062
commit 15b6ed0419
14 changed files with 281 additions and 118 deletions

View file

@ -3,15 +3,35 @@ title: layout
---
The `layout` setting allows you to control the way pattern parts are
layed out on the pattern. There are 3 scenarios:
layed out on the pattern. Either automatic, explicit, or not at all.
## Signature
```js
const settings = {
Boolean|Object layout=true
}
```
There are 3 scenarios:
- layout is truthy: Do layout algorithmically
- layout is falsy: Do not do any layout apart from stacking all parts together
- layout is an object: Layout the parts as detailed in the layout object
Let's look at each in detail:
## example
## layout is truthy
```js
import { Aaron } from "@freesewing/aaron"
const pattern = new aaron({
layout: false
})
```
## Notes
### Behavior when layout is truthy
This is the default behaviour. Parts will be laid without overlap in
a space that's a small as possible.
@ -20,7 +40,7 @@ Don't expect miracles here.
It's one of those things humans are far better at than
computers.
## layout is falsy
### Behavior when layout is falsy
This will cause all parts to be laid out on top of each other.
@ -28,15 +48,15 @@ It is almost certainly not what you want, but having all parts piled
on top of each other in the top left corner can be a good starting
point for a custom layout.
## layout is a layout object
### Behavior when layout is a layout object
This allows you to control the layout by passing a layout object.
This object should be structures as such:
```js
import brian from "@freesewing/brian";
import { Aaron } from "@freesewing/aaron"
let pattern = new brian({
const pattern = new Aaron({
layout: {
parts: {
front: {
@ -61,12 +81,3 @@ For each part in the `parts` attribute of our layout object, there are 4 possibl
- rotate: Expects a number, and will rotate the part by number degrees around its center point
- flipX: Will flip/mirror the part horizontally
- flipY: Will flip/mirror the part vertically
<Related>
It is a long-standing ambition of ours to build a layout component that allows
users to manually do the layout of their pattern.
Core already supports it, but building a React component for it is non-trivial.
</Related>