1
0
Fork 0

fix(dev/docs): Add expand setting

This commit is contained in:
Benjamin Fan 2025-05-23 20:05:28 -07:00 committed by Joost De Cock
parent f903929a0a
commit 19397c1c6e
3 changed files with 78 additions and 33 deletions

View file

@ -13,35 +13,36 @@ function draft(props)
The draft method receives a single parameter, an object which you can _destructure_ to The draft method receives a single parameter, an object which you can _destructure_ to
access the following properties: access the following properties:
| Property | Description | | Property | Description |
| --------:|:----------- | | ----------------: | :------------------------------------------------------------------------------------------------------------ |
|| **_Content constructors_** | | | **_Content constructors_** |
| `Path` | A [Path constructor](/reference/api/path) to create new paths | | `Path` | A [Path constructor](/reference/api/path) to create new paths |
| `Point` | A [Point constructor](/reference/api/point) to create new points | | `Point` | A [Point constructor](/reference/api/point) to create new points |
| `Snippet` | A [Snippet constructor](/reference/api/snippet) to create new snippets | | `Snippet` | A [Snippet constructor](/reference/api/snippet) to create new snippets |
|| **_Content containers_** | | | **_Content containers_** |
| `paths` | Add a Path to your part by adding it to this object | | `paths` | Add a Path to your part by adding it to this object |
| `points` | Add a Points to your part by adding it to this object | | `points` | Add a Points to your part by adding it to this object |
| `snippets` | Add a Snippet to your part by adding it to this object | | `snippets` | Add a Snippet to your part by adding it to this object |
|| **_Access to settings_** | | | **_Access to settings_** |
| `absoluteOptions` | Access to `settings.absoluteOptions` | | `absoluteOptions` | Access to `settings.absoluteOptions` |
| `complete` | Access to `settings.complete` | | `complete` | Access to `settings.complete` |
| `measurements` | Access to `settings.measurements` | | `expand` | Access to `settings.expand` |
| `options` | Access to `settings.options` | | `measurements` | Access to `settings.measurements` |
| `paperless` | Access to `settings.paperless` | | `options` | Access to `settings.options` |
| `sa` | Access to `settings.sa` | | `paperless` | Access to `settings.paperless` |
| `scale` | Access to `settings.scale` | | `sa` | Access to `settings.sa` |
|| **_Access to utilities_** | | `scale` | Access to `settings.scale` |
| `context` | Allows access to the pattern object and other things higher in the tree | | | **_Access to utilities_** |
| `getId` | See [the getId documentation](/reference/api/part/getid) | | `context` | Allows access to the pattern object and other things higher in the tree |
| `log` | See [the Store Methods documentation](/reference/store-methods#store-methods-we-maintain) | | `getId` | See [the getId documentation](/reference/api/part/getid) |
| `macro` | See [the macros documentation](/reference/macros/) | | `log` | See [the Store Methods documentation](/reference/store-methods#store-methods-we-maintain) |
| `store` | See [the store documentation](/reference/api/store) | | `macro` | See [the macros documentation](/reference/macros/) |
| `units` | A version of [`utils.units()`](/reference/api/utils/units) that is preconfigured with the user's chosen units | | `store` | See [the store documentation](/reference/api/store) |
| `utils` | See [the utils documentation](/reference/api/utils) | | `units` | A version of [`utils.units()`](/reference/api/utils/units) that is preconfigured with the user's chosen units |
| `Bezier` | The [bezier-js](https://pomax.github.io/bezierjs/) library's `Bezier` named export | | `utils` | See [the utils documentation](/reference/api/utils) |
|| **_Return value_** | | `Bezier` | The [bezier-js](https://pomax.github.io/bezierjs/) library's `Bezier` named export |
| `part` | Your draft method **must** return this | | | **_Return value_** |
| `part` | Your draft method **must** return this |
:::tip :::tip

View file

@ -0,0 +1,44 @@
---
title: expand
---
The `expand` setting controls whether all parts should be fully
drawn in a pattern.
Set `expand` to `false` when the pattern should instead omit parts and/or
draw abbreviated parts.
Omitting parts and using abbreviated parts saves space and paper
in printed patterns.
Typically, this is done for parts that are simple shapes like
rectangles or that can be cut on the fold.
## Signature
```js
const settings = {
Boolean expand=true
}
```
The default `expand` setting is `true`.
Set this to `false` to draft a pattern with omitted or abbreviated parts,
rather than with fully-drawn parts.
## Example
```js
import { Aaron } from '@freesewing/aaron'
const pattern = new Aaron({
expand: false,
})
```
## Notes
The `expand` setting does not automatically cause pattern parts to
be omitted or abbreviated.
Instead, it is up to the pattern designer to have the design
check for the `expand` setting,
include all, full parts if set to `true`,
and omit or abbreviate relevant parts if set to `false`.

View file

@ -3,7 +3,7 @@ title: Settings
--- ---
FreeSewing is all about parametric design, and the settings are the parameters FreeSewing is all about parametric design, and the settings are the parameters
we pass to a pattern when drafting it. Perhaps the most important of all we pass to a pattern when drafting it. Perhaps the most important of all
settings are the measurements, but there are other settings too. settings are the measurements, but there are other settings too.
## Signature ## Signature
@ -13,6 +13,7 @@ Object settings = {
Object absoluteOptions, Object absoluteOptions,
Boolean complete=true, Boolean complete=true,
Boolean embed=false, Boolean embed=false,
Boolean expand=true,
String idPrefix='fs-', String idPrefix='fs-',
Object|Boolean layout=true, Object|Boolean layout=true,
String locale='en', String locale='en',
@ -43,12 +44,11 @@ objects in an array to the pattern constructor:
```js ```js
new pattern([ new pattern([
{ {
// settings // settings
}, },
{ {
// different settings // different settings
}, },
]) ])
``` ```