chore: More linting
@nicholasdower is smarter than me. What's missing was the `listItemIndent` setting
This commit is contained in:
parent
e6f1189017
commit
249f2600e5
293 changed files with 2170 additions and 2169 deletions
|
@ -33,8 +33,8 @@ dependencies: {
|
|||
|
||||
In this example:
|
||||
|
||||
- The `front` part depends on the `back` part
|
||||
- The `sleeveplacket` part depends on the `sleeve` and `cuff` parts.
|
||||
- The `front` part depends on the `back` part
|
||||
- The `sleeveplacket` part depends on the `sleeve` and `cuff` parts.
|
||||
|
||||
<Tip>
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ configuration file.
|
|||
|
||||
They hold a plain object where each property can hold:
|
||||
|
||||
- An array of strings that are the names of the options to include in the group
|
||||
- A plain object whose properties hold an array of strings that are the names
|
||||
of the options to include in the group. (this creates a subgroup)
|
||||
- An array of strings that are the names of the options to include in the group
|
||||
- A plain object whose properties hold an array of strings that are the names
|
||||
of the options to include in the group. (this creates a subgroup)
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -53,12 +53,12 @@ optionGroups: {
|
|||
|
||||
The configuration above will create the following structure:
|
||||
|
||||
- **fit**
|
||||
- `chestEase`
|
||||
- `waistEase`
|
||||
- **style**
|
||||
- `cuffStyle`
|
||||
- `hemStyle`
|
||||
- **collar**
|
||||
- `collarHeight`
|
||||
- `collarShape`
|
||||
- **fit**
|
||||
- `chestEase`
|
||||
- `waistEase`
|
||||
- **style**
|
||||
- `cuffStyle`
|
||||
- `hemStyle`
|
||||
- **collar**
|
||||
- `collarHeight`
|
||||
- `collarShape`
|
||||
|
|
|
@ -9,8 +9,8 @@ or **yes** or **no**, use a boolean option.
|
|||
|
||||
A boolean option is a plain object with these properties:
|
||||
|
||||
- `bool` : Either `true` or `false` which will be the default
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `bool` : Either `true` or `false` which will be the default
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
|
||||
[hide]: /reference/api/config/options#optionally-hide-options-by-configuring-a-hide-method
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ options: {
|
|||
|
||||
There are typically two use-cases for constant options:
|
||||
|
||||
- Rather than define constants in your code, it's good practice to set
|
||||
them in your configuration file. This way, people who extend your
|
||||
pattern can change them if they would like to.
|
||||
- A constant option can be used as a feature-flag. Enabling or disabling
|
||||
parts of the code beyond the control of the end user, but accessible to
|
||||
developers.
|
||||
- Rather than define constants in your code, it's good practice to set
|
||||
them in your configuration file. This way, people who extend your
|
||||
pattern can change them if they would like to.
|
||||
- A constant option can be used as a feature-flag. Enabling or disabling
|
||||
parts of the code beyond the control of the end user, but accessible to
|
||||
developers.
|
||||
|
||||
</Tip>
|
||||
|
|
|
@ -9,10 +9,10 @@ Counters are for integers only. Things like number of buttons and so on.
|
|||
|
||||
Your counter option should be a plain object with these properties:
|
||||
|
||||
- `count` : The default integer value
|
||||
- `min` : The minimal integer value that's allowed
|
||||
- `max` : The maximum integer value that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `count` : The default integer value
|
||||
- `min` : The minimal integer value that's allowed
|
||||
- `max` : The maximum integer value that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
|
||||
[hide]: /reference/api/config/options#optionally-hide-options-by-configuring-a-hide-method
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ For angles, use a degree option.
|
|||
|
||||
Your degree option should be a plain object with these properties:
|
||||
|
||||
- `deg` : The default value in degrees
|
||||
- `min` : The minimul that's allowed
|
||||
- `max` : The maximum that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `deg` : The default value in degrees
|
||||
- `min` : The minimul that's allowed
|
||||
- `max` : The maximum that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
|
||||
[hide]: /reference/api/config/options#optionally-hide-options-by-configuring-a-hide-method
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ possible.
|
|||
There are the five option types that an aspiring pattern designer should be
|
||||
familiar with:
|
||||
|
||||
1. [**boolean** options][bool] are for yes/no choices
|
||||
2. [**counter** options][count] are for integer values
|
||||
3. [**degree** options][deg] are for degrees
|
||||
4. [**list** options][list] are for a list of possible choices
|
||||
5. [**percentage** options][pct] are for percentages
|
||||
1. [**boolean** options][bool] are for yes/no choices
|
||||
2. [**counter** options][count] are for integer values
|
||||
3. [**degree** options][deg] are for degrees
|
||||
4. [**list** options][list] are for a list of possible choices
|
||||
5. [**percentage** options][pct] are for percentages
|
||||
|
||||
<Tip>
|
||||
|
||||
|
@ -43,10 +43,10 @@ They also have the most features and flexibility.
|
|||
|
||||
For the sake of completeness, here are the two other types of options:
|
||||
|
||||
6. [**constant** options][const] are used as
|
||||
[feature flags](https://en.wikipedia.org/wiki/Feature_toggle)
|
||||
7. [**millimeter** options][const] are **deprecated** (in favor of [snapped
|
||||
percentage options][snapped])
|
||||
6. [**constant** options][const] are used as
|
||||
[feature flags](https://en.wikipedia.org/wiki/Feature_toggle)
|
||||
7. [**millimeter** options][const] are **deprecated** (in favor of [snapped
|
||||
percentage options][snapped])
|
||||
|
||||
</Related>
|
||||
|
||||
|
@ -83,9 +83,9 @@ it is not intended as a way to block access to a given option. It merely hides i
|
|||
|
||||
By default options are shown to the user when:
|
||||
|
||||
- They are not a constant option
|
||||
- **and**
|
||||
- They are included in an optionGroup
|
||||
- They are not a constant option
|
||||
- **and**
|
||||
- They are included in an optionGroup
|
||||
|
||||
You can further control the optional display of options by adding a method
|
||||
to the `hide` key under you option, as such:
|
||||
|
@ -110,8 +110,8 @@ So you can make a choice whether to show the option or not.
|
|||
|
||||
If it's not obvious from the name, your `hide()` method you should:
|
||||
|
||||
- Return `true` or a truthy value to hide the option
|
||||
- Return `false` or a falsy value to show the option
|
||||
- Return `true` or a truthy value to hide the option
|
||||
- Return `false` or a falsy value to show the option
|
||||
|
||||
<Tip>
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ Use a list option when you want to offer an array of choices.
|
|||
|
||||
Your list option should be a plain object with these properties:
|
||||
|
||||
- `dflt` : The default for this option
|
||||
- `list` : An array of available values options
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `dflt` : The default for this option
|
||||
- `list` : An array of available values options
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
|
||||
[hide]: /reference/api/config/options#optionally-hide-options-by-configuring-a-hide-method
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ contributions that use millimeter options.
|
|||
|
||||
A millimeter option should be a plain object with these properties:
|
||||
|
||||
- `mm` : The default value in millimeter
|
||||
- `min` : The minimul that's allowed
|
||||
- `max` : The maximum that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `mm` : The default value in millimeter
|
||||
- `min` : The minimul that's allowed
|
||||
- `max` : The maximum that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
|
||||
[hide]: /reference/api/config/options#optionally-hide-options-by-configuring-a-hide-method
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ they ensure that your pattern will scale regardless of size.
|
|||
|
||||
Your percentage option should be a plain object with these properties:
|
||||
|
||||
- `pct` : The default percentage
|
||||
- `min` : The minimum percentage that's allowed
|
||||
- `max` : The maximum percentage that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `fromAbs` <small>(optional)</small> : A method to [determine the percentage based on a value in millimeter][fromabs]
|
||||
- `toAbs` <small>(optional)</small> : A method to [return the option value in millimeter][toabs]
|
||||
- `snap` <small>(optional)</small> : The configuration to control [snapping of percentage options][snap]
|
||||
- `pct` : The default percentage
|
||||
- `min` : The minimum percentage that's allowed
|
||||
- `max` : The maximum percentage that's allowed
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `fromAbs` <small>(optional)</small> : A method to [determine the percentage based on a value in millimeter][fromabs]
|
||||
- `toAbs` <small>(optional)</small> : A method to [return the option value in millimeter][toabs]
|
||||
- `snap` <small>(optional)</small> : The configuration to control [snapping of percentage options][snap]
|
||||
|
||||
[hide]: /reference/api/config/options#optionally-hide-options-by-configuring-a-hide-method
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ is found.
|
|||
|
||||
Your snapped percentage option should be a plain object with these properties:
|
||||
|
||||
- `pct` : The default percentage
|
||||
- `min` : The minimum percentage that's allowed
|
||||
- `max` : The maximum percentage that's allowed
|
||||
- `snap`: Holds the snap configuration (see [Snap configuration](#))
|
||||
- `toAbs`: a method returning the **millimeter value** of the option ([see `toAbs()`][toabs])
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
- `pct` : The default percentage
|
||||
- `min` : The minimum percentage that's allowed
|
||||
- `max` : The maximum percentage that's allowed
|
||||
- `snap`: Holds the snap configuration (see [Snap configuration](#))
|
||||
- `toAbs`: a method returning the **millimeter value** of the option ([see `toAbs()`][toabs])
|
||||
- `hide` <small>(optional)</small> : A method to [control the optional display of the option][hide]
|
||||
|
||||
## Snap configuration
|
||||
|
||||
|
@ -150,8 +150,8 @@ our solution does not scale.
|
|||
We combine approaches A and B and configure a snapped percentage option
|
||||
with:
|
||||
|
||||
- A percentage based on `waistToFloor`
|
||||
- Our list of standard elastic widths as _snaps_
|
||||
- A percentage based on `waistToFloor`
|
||||
- Our list of standard elastic widths as _snaps_
|
||||
|
||||
For typical humans, our options will _snap_ to the closest match in our
|
||||
list and behave just like Approach A (with a list option).
|
||||
|
@ -165,19 +165,19 @@ Sweet!
|
|||
|
||||
Before we wade into the details, let's first agree on terminology:
|
||||
|
||||
- The **percentage value** is the page passed by the user for the option.
|
||||
Its value always represents a percentage.
|
||||
- The **millimeter value** is the result of feeding the **percentage value** to
|
||||
the `toAbs()` method. Its value always represents millimeters.
|
||||
- The **snap values** are the values provided by the snap confguration.
|
||||
Each of the values always represents millimeters.
|
||||
- The **percentage value** is the page passed by the user for the option.
|
||||
Its value always represents a percentage.
|
||||
- The **millimeter value** is the result of feeding the **percentage value** to
|
||||
the `toAbs()` method. Its value always represents millimeters.
|
||||
- The **snap values** are the values provided by the snap confguration.
|
||||
Each of the values always represents millimeters.
|
||||
|
||||
Under the hood, and snapped percentage option will:
|
||||
|
||||
- Use `toAbs()` to calculate the **millimeter value** from the **percentage value**
|
||||
- See whether the **millimeter value** approaches one of the **snap values**
|
||||
- If so, use the snap value (in millimeter) as provided by one of the **snap values**
|
||||
- If not, use the **millimeter value** as-is
|
||||
- Use `toAbs()` to calculate the **millimeter value** from the **percentage value**
|
||||
- See whether the **millimeter value** approaches one of the **snap values**
|
||||
- If so, use the snap value (in millimeter) as provided by one of the **snap values**
|
||||
- If not, use the **millimeter value** as-is
|
||||
|
||||
If you're head's spinning, here's an image that will hopefully clarify things a bit:
|
||||
|
||||
|
@ -200,12 +200,12 @@ snapping, just as it would in a normal percentage option.
|
|||
|
||||
This system results in the best of both worlds:
|
||||
|
||||
- Things like elastic widths and so on can be configured to be fixed values,
|
||||
of common elastic widths for example
|
||||
- The absolute value will still scale up and down, but will snap to the closest
|
||||
fixed value when appropriate.
|
||||
- When the input measurements go somewhere the designer did not anticipate,
|
||||
the option will just behave as a regular percentage option
|
||||
- Things like elastic widths and so on can be configured to be fixed values,
|
||||
of common elastic widths for example
|
||||
- The absolute value will still scale up and down, but will snap to the closest
|
||||
fixed value when appropriate.
|
||||
- When the input measurements go somewhere the designer did not anticipate,
|
||||
the option will just behave as a regular percentage option
|
||||
|
||||
## Using snapped percentage options in your pattern code
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ department: "menswear",
|
|||
|
||||
One of the following:
|
||||
|
||||
- menswear
|
||||
- womenswear
|
||||
- unisex
|
||||
- accessories
|
||||
- menswear
|
||||
- womenswear
|
||||
- unisex
|
||||
- accessories
|
||||
|
|
|
@ -8,5 +8,5 @@ type: "pattern",
|
|||
|
||||
One of the following:
|
||||
|
||||
- pattern
|
||||
- block
|
||||
- pattern
|
||||
- block
|
||||
|
|
|
@ -19,10 +19,10 @@ function freesewing.Design(
|
|||
This constructor creates a new pattern design.
|
||||
It takes the following arguments:
|
||||
|
||||
- `config` : The pattern configuration
|
||||
- `plugins` : Either a [plugin object](/guides/plugins/), or an array of plugin objects
|
||||
- `conditionalPlugins` : Either a [conditional plugin object](/guides/plugins/conditionally-loading-build-time-plugins/), or an array
|
||||
of conditional plugin objects to (conditionally) load in your pattern
|
||||
- `config` : The pattern configuration
|
||||
- `plugins` : Either a [plugin object](/guides/plugins/), or an array of plugin objects
|
||||
- `conditionalPlugins` : Either a [conditional plugin object](/guides/plugins/conditionally-loading-build-time-plugins/), or an array
|
||||
of conditional plugin objects to (conditionally) load in your pattern
|
||||
|
||||
```js
|
||||
import freesewing from "@freesewing/core"
|
||||
|
|
|
@ -25,7 +25,7 @@ please refer to our [pattern design tutorial](/tutorials/pattern-design/)
|
|||
|
||||
The `@freesewing/core` default export is a single object with the following properties:
|
||||
|
||||
- `Design`: The [Design constructor](/reference/api/design/) to create a new design
|
||||
- `Design`: The [Design constructor](/reference/api/design/) to create a new design
|
||||
|
||||
<Note>
|
||||
|
||||
|
@ -34,9 +34,9 @@ The other constructors and utilities below are exported to facilitate unit testi
|
|||
|
||||
</Note>
|
||||
|
||||
- `Path`: The [Path constructor](/reference/api/path) to create a new path
|
||||
- `Pattern`: The [Pattern constructor](/reference/api/pattern) to create a new pattern
|
||||
- `Point`: The [Point constructor](/reference/api/point) to create a new point
|
||||
- `Snippet`: The [Snippet constructor](/reference/api/snippet) to create a new snippet
|
||||
- `utils`: A collection of [utilities](/reference/api/utils)
|
||||
- `version`: A string containing the `@freesewing/core` version number
|
||||
- `Path`: The [Path constructor](/reference/api/path) to create a new path
|
||||
- `Pattern`: The [Pattern constructor](/reference/api/pattern) to create a new pattern
|
||||
- `Point`: The [Point constructor](/reference/api/point) to create a new point
|
||||
- `Snippet`: The [Snippet constructor](/reference/api/snippet) to create a new snippet
|
||||
- `utils`: A collection of [utilities](/reference/api/utils)
|
||||
- `version`: A string containing the `@freesewing/core` version number
|
||||
|
|
|
@ -9,8 +9,8 @@ A **hook** is a lifecycle event.
|
|||
You can register a method for a hook. When the hook is triggered, your method will be
|
||||
called. It will receive two parameters:
|
||||
|
||||
- An object relevant to the hook (see the specific hook for details)
|
||||
- Data passed when the hook was registered (optional)
|
||||
- An object relevant to the hook (see the specific hook for details)
|
||||
- Data passed when the hook was registered (optional)
|
||||
|
||||
Below is a list of all available hooks:
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ The `insertText` hook is called when text is about to be inserted during renderi
|
|||
|
||||
Methods attached to the `insertText` hook will receive 2 parameters:
|
||||
|
||||
- `locale` : The language code of the language requested by the user (defaults to `en`)
|
||||
- `text`: The text to be inserted
|
||||
- `locale` : The language code of the language requested by the user (defaults to `en`)
|
||||
- `text`: The text to be inserted
|
||||
|
||||
Unlike most hooks that receive an object that you can make changes to,
|
||||
for this hook you need to return a string.
|
||||
|
@ -20,8 +20,8 @@ in [our i18n plugin](/reference/plugins/i18n/).
|
|||
When we say that _this hook is called when text is about to be inserted_, that is a simplified view.
|
||||
In reality, this hook is called:
|
||||
|
||||
- For every value set on data-text
|
||||
- For the combined result of these values, joined together with spaces
|
||||
- For every value set on data-text
|
||||
- For the combined result of these values, joined together with spaces
|
||||
|
||||
Let's use an example to clarify things:
|
||||
|
||||
|
@ -33,9 +33,9 @@ points.example
|
|||
|
||||
For the example point above, the `insertText` hook will end up being called 3 times:
|
||||
|
||||
- First it will pass `seamAllowance` to the plugin
|
||||
- Then it will pass `: 1cm` to the plugin
|
||||
- Finally it will pass `seamAllowance : 1cm` to the plugin
|
||||
- First it will pass `seamAllowance` to the plugin
|
||||
- Then it will pass `: 1cm` to the plugin
|
||||
- Finally it will pass `seamAllowance : 1cm` to the plugin
|
||||
|
||||
Having the `insertText` hook only run once with `Seam allowance: 1cm` would be problematic because
|
||||
the seam allowance may differ, or perhaps we're using imperial units, and so on.
|
||||
|
|
|
@ -7,9 +7,9 @@ Your plugin will receive the Pattern object.
|
|||
|
||||
It is triggered just before the end of either:
|
||||
|
||||
- the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
- the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
- the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
- the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
- the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
- the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
|
||||
<Note>
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ The `preSample` hook runs just before your pattern is sampled.
|
|||
|
||||
It is triggered at the very start of either:
|
||||
|
||||
- the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
- the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
- the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
- the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
- the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
- the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
|
||||
Your plugin will receive the Pattern object.
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ macro("flip", {
|
|||
|
||||
Under the hood, this macro will:
|
||||
|
||||
- Go through all Points in your Part, and multiply their (X or Y)-coordinate by -1
|
||||
- Go through all the Paths in your Part, and for each drawing operation will multiply the (X or Y)-coordinare by -1
|
||||
- Go through all the Snippets in your Part and multiply the (X or Y)-coordinate of the anchor point by -1
|
||||
- Go through all Points in your Part, and multiply their (X or Y)-coordinate by -1
|
||||
- Go through all the Paths in your Part, and for each drawing operation will multiply the (X or Y)-coordinare by -1
|
||||
- Go through all the Snippets in your Part and multiply the (X or Y)-coordinate of the anchor point by -1
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -31,7 +31,7 @@ macro('hd', {
|
|||
|
||||
Setting a custom ID will:
|
||||
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -31,7 +31,7 @@ macro('ld', {
|
|||
|
||||
Setting a custom ID will:
|
||||
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -29,7 +29,7 @@ macro('pd', {
|
|||
|
||||
Setting a custom ID will:
|
||||
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -31,7 +31,7 @@ macro('vd', {
|
|||
|
||||
Setting a custom ID will:
|
||||
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
|
||||
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -8,14 +8,14 @@ Point path.edge(string side)
|
|||
|
||||
Returns the Point object at the edge of the path you specify. Edge must be one of:
|
||||
|
||||
- `top`
|
||||
- `bottom`
|
||||
- `left`
|
||||
- `right`
|
||||
- `topLeft`
|
||||
- `topRight`
|
||||
- `bottomLeft`
|
||||
- `bottomRight`
|
||||
- `top`
|
||||
- `bottom`
|
||||
- `left`
|
||||
- `right`
|
||||
- `topLeft`
|
||||
- `topRight`
|
||||
- `bottomLeft`
|
||||
- `bottomRight`
|
||||
|
||||
<Example part="path_edge">
|
||||
Example of the Path.edge() method
|
||||
|
|
|
@ -13,8 +13,8 @@ Path new Path();
|
|||
|
||||
A Path objects comes with the following properties:
|
||||
|
||||
- `render` : Set this to `false` to not render the path (exclude it from the output)
|
||||
- `attributes` : An [Attributes](/reference/api/attributes) instance holding the path's attributes
|
||||
- `render` : Set this to `false` to not render the path (exclude it from the output)
|
||||
- `attributes` : An [Attributes](/reference/api/attributes) instance holding the path's attributes
|
||||
|
||||
In addition, a Path object exposes the following methods:
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ it on a long/complex path will be significant.
|
|||
|
||||
To limit the impact of path.trim(), follow this approach:
|
||||
|
||||
- construct a minimal path that contains the overlap
|
||||
- trim it
|
||||
- now join it to the rest of your path
|
||||
- construct a minimal path that contains the overlap
|
||||
- trim it
|
||||
- now join it to the rest of your path
|
||||
|
||||
You can see an example of this
|
||||
[in the front part of the Bruce pattern](https://github.com/freesewing/freesewing/blob/develop/packages/bruce/src/front.js#L195).
|
||||
|
|
|
@ -20,14 +20,14 @@ Refer to the [settings documentation](/reference/api/settings/) for an exhaustiv
|
|||
|
||||
## Pattern properties
|
||||
|
||||
- `settings` : The settings as set by the user
|
||||
- `options` : the options as set by the user
|
||||
- `config` : The pattern configuration
|
||||
- `parts` : A plain object to hold your parts
|
||||
- `Part` : The [Part](/reference/api/part) constructor
|
||||
- `store` : A [Store](/reference/api/store) instance
|
||||
- `svg` : An [Svg](/reference/api/svg) instance
|
||||
- `is` : A string that will be set to `draft` or `sample` when you respectively draft or sample a pattern. This allows plugins that hook into your pattern to determine what to do in a given scenario.
|
||||
- `settings` : The settings as set by the user
|
||||
- `options` : the options as set by the user
|
||||
- `config` : The pattern configuration
|
||||
- `parts` : A plain object to hold your parts
|
||||
- `Part` : The [Part](/reference/api/part) constructor
|
||||
- `store` : A [Store](/reference/api/store) instance
|
||||
- `svg` : An [Svg](/reference/api/svg) instance
|
||||
- `is` : A string that will be set to `draft` or `sample` when you respectively draft or sample a pattern. This allows plugins that hook into your pattern to determine what to do in a given scenario.
|
||||
|
||||
## Pattern methods
|
||||
|
||||
|
|
|
@ -16,16 +16,16 @@ object to determine what to do.
|
|||
|
||||
The possiblities are:
|
||||
|
||||
- **type**: One of `option`, `measurement`, or `models`
|
||||
- **option**: An option name as defined in the pattern config file (only used when `type` is option).
|
||||
- **measurement**: A measurement name as defined in the pattern config file (only used when `type` is measurement).
|
||||
- **models**: An array of models with the required measurements for this pattern (only used when `type` is models).
|
||||
- **type**: One of `option`, `measurement`, or `models`
|
||||
- **option**: An option name as defined in the pattern config file (only used when `type` is option).
|
||||
- **measurement**: A measurement name as defined in the pattern config file (only used when `type` is measurement).
|
||||
- **models**: An array of models with the required measurements for this pattern (only used when `type` is models).
|
||||
|
||||
See the specific sample methods below for more details:
|
||||
|
||||
- [Pattern.sampleOption()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleModels()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleOption()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleModels()](/reference/apu/pattern/sampleoption)
|
||||
|
||||
From a lifecycle point of view, the `Pattern.sample()` method is a substitute for
|
||||
`Pattern.draft()`. So you call it after instantiating the pattern, prior to
|
||||
|
|
|
@ -7,9 +7,9 @@ which means to draft it in different iterations while adjusting the input value
|
|||
of the given option.
|
||||
The practical implementation varies based on [the type of option](/config/options/):
|
||||
|
||||
- For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max
|
||||
- For options that are a numeric value (**constants**), 10 steps will be sampled between 90% and 110% of the value
|
||||
- For options with a **list** of options, each option in the list will be sampled
|
||||
- For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max
|
||||
- For options that are a numeric value (**constants**), 10 steps will be sampled between 90% and 110% of the value
|
||||
- For options with a **list** of options, each option in the list will be sampled
|
||||
|
||||
<Tip>
|
||||
The goal of option sampling is to verify the impact of an option on the pattern, and verify that
|
||||
|
|
|
@ -7,14 +7,14 @@ A Point object represents a point on a 2D plane with an X and Y axis.
|
|||
|
||||
Point objects come with the following properties:
|
||||
|
||||
- `x` : The X-coordinate of the point
|
||||
- `y` : The Y-coordinate of the point
|
||||
- `attributes` : An [Attributes](../attributes) instance holding the point's attributes
|
||||
- `x` : The X-coordinate of the point
|
||||
- `y` : The Y-coordinate of the point
|
||||
- `attributes` : An [Attributes](../attributes) instance holding the point's attributes
|
||||
|
||||
The point constructor takes two arguments:
|
||||
|
||||
- `x` : The X-coordinate of the point
|
||||
- `y` : The Y-coordinate of the point
|
||||
- `x` : The X-coordinate of the point
|
||||
- `y` : The Y-coordinate of the point
|
||||
|
||||
```js
|
||||
Point new Point(x, y);
|
||||
|
|
|
@ -12,8 +12,8 @@ Point point.translate(float deltaX, float deltaY)
|
|||
|
||||
In other words, this will:
|
||||
|
||||
- Add `deltaX` to the point's X-coordinate
|
||||
- Add `deltaY` to the point's Y-coordinate
|
||||
- Add `deltaX` to the point's X-coordinate
|
||||
- Add `deltaY` to the point's Y-coordinate
|
||||
|
||||
Positive values for `deltaX` will move the point to the right. Positive values for `deltaY` will move the point downwards.
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ title: layout
|
|||
The `layout` setting allows you to control the way pattern parts are
|
||||
layed out on the pattern. 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
|
||||
- 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:
|
||||
|
||||
|
@ -57,10 +57,10 @@ let pattern = new brian({
|
|||
|
||||
For each part in the `parts` attribute of our layout object, there are 4 possible attributes:
|
||||
|
||||
- move: Expects an object with an `x` and `y` property, and will move the part by `x` along the X-axis and by `y` along the Y-axis
|
||||
- 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
|
||||
- move: Expects an object with an `x` and `y` property, and will move the part by `x` along the X-axis and by `y` along the Y-axis
|
||||
- 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>
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ Each part will have this margin applied. The default is `2mm`.
|
|||
|
||||
This means that:
|
||||
|
||||
- At the edge of the SVG, the margin will be `margin * 1` (2mm by default)
|
||||
- Between parts, the margin will be `margin * 2` (4mm by default)
|
||||
- At the edge of the SVG, the margin will be `margin * 1` (2mm by default)
|
||||
- Between parts, the margin will be `margin * 2` (4mm by default)
|
||||
|
||||
Note that setting the margin to zero (or below) will cause parts to overlap.
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ SVG `defs` section, and rendered with the SVG `use` tag.
|
|||
|
||||
The snippet constructor takes two arguments:
|
||||
|
||||
- `def` : The `xlink:href` id that links to the relevant entry in the SVG `defs` section
|
||||
- `anchor` : A [`Point`](#point) on which to anchor the snippet
|
||||
- `def` : The `xlink:href` id that links to the relevant entry in the SVG `defs` section
|
||||
- `anchor` : A [`Point`](#point) on which to anchor the snippet
|
||||
|
||||
```js
|
||||
Snippet new Snippet(def, Point);
|
||||
|
@ -17,9 +17,9 @@ Snippet new Snippet(def, Point);
|
|||
|
||||
A Snippet object comes with the following properties:
|
||||
|
||||
- `def` : The `xlink:href` id that links to the relevant entry in the SVG `defs` section
|
||||
- `anchor` : A [`Point`](../point) on which to anchor the snippet
|
||||
- `attributes` : An [`Attributes`](../attributes) instance holding the snippet's attributes
|
||||
- `def` : The `xlink:href` id that links to the relevant entry in the SVG `defs` section
|
||||
- `anchor` : A [`Point`](../point) on which to anchor the snippet
|
||||
- `attributes` : An [`Attributes`](../attributes) instance holding the snippet's attributes
|
||||
|
||||
In addition, a Snippet object exposes the following methods:
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ An example of the buttonhole-end snippet
|
|||
|
||||
We provide three buttonhole snippets with a different alignment:
|
||||
|
||||
- [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
|
||||
- [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
|
||||
- [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
|
||||
- [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
|
||||
- [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
|
||||
- [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -19,8 +19,8 @@ An example of the buttonhole-start snippet
|
|||
|
||||
We provide three buttonhole snippets with a different alignment:
|
||||
|
||||
- [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
|
||||
- [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
|
||||
- [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
|
||||
- [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
|
||||
- [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
|
||||
- [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -19,8 +19,8 @@ An example of the buttonhole snippet
|
|||
|
||||
We provide three buttonhole snippets with a different alignment:
|
||||
|
||||
- [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
|
||||
- [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
|
||||
- [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
|
||||
- [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
|
||||
- [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
|
||||
- [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
|
||||
|
||||
</Note>
|
||||
|
|
|
@ -21,8 +21,8 @@ they are ordered in the returned array:
|
|||
|
||||
Set sort to:
|
||||
|
||||
- `x` : The point with the lowest X-coordinate will go first (left to right)
|
||||
- `y` : The point with the lowest Y-coordinate will go first (top to bottom)
|
||||
- `x` : The point with the lowest X-coordinate will go first (left to right)
|
||||
- `y` : The point with the lowest Y-coordinate will go first (top to bottom)
|
||||
|
||||
<Example part="utils_beamintersectscircle">
|
||||
A Utils.beamIntersectsCircle() example
|
||||
|
|
|
@ -19,8 +19,8 @@ When this returns 2 intersections, you can choose how they are ordered in the re
|
|||
|
||||
Set sort to:
|
||||
|
||||
- `x` : The point with the lowest X-coordinate will go first (left to right)
|
||||
- `y` : The point with the lowest Y-coordinate will go first (top to bottom)
|
||||
- `x` : The point with the lowest X-coordinate will go first (left to right)
|
||||
- `y` : The point with the lowest Y-coordinate will go first (top to bottom)
|
||||
|
||||
<Example part="utils_circlesintersect">
|
||||
A Utils.circlesIntersect() example
|
||||
|
|
|
@ -20,8 +20,8 @@ When this returns 2 intersections, you can choose how they are ordered in the re
|
|||
|
||||
Set sort to:
|
||||
|
||||
- `x` : The point with the lowest X-coordinate will go first (left to right)
|
||||
- `y` : The point with the lowest Y-coordinate will go first (top to bottom)
|
||||
- `x` : The point with the lowest X-coordinate will go first (left to right)
|
||||
- `y` : The point with the lowest Y-coordinate will go first (top to bottom)
|
||||
|
||||
<Example part="utils_lineintersectscircle">
|
||||
A Utils.lineIntersectsCircle() example
|
||||
|
|
|
@ -8,5 +8,5 @@ float utils.round(float value)
|
|||
|
||||
Rounds a value to two decimals. For example:
|
||||
|
||||
- 0.1234 becomes 0.12
|
||||
- 5.6789 becomes 5.68
|
||||
- 0.1234 becomes 0.12
|
||||
- 5.6789 becomes 5.68
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue