1
0
Fork 0

Merge branch 'develop' into eriese-v3-printing

This commit is contained in:
Enoch Riese 2022-12-12 09:44:25 -06:00
commit d78b2bb6c1
54 changed files with 869 additions and 645 deletions

View file

@ -3,7 +3,7 @@ title: Loading plugins
order: 140 order: 140
--- ---
Plugins can be loaded at build time and added to the desig. Or at run time and added to an instantiated pattern. Plugins can be loaded at build time and added to the design. Or at run time and added to an instantiated pattern.
To load a plugin at build time, it should be added to [the `plugins` key of the part configuration](/reference/api/part/config/plugins). To load a plugin at build time, it should be added to [the `plugins` key of the part configuration](/reference/api/part/config/plugins).

View file

@ -10,7 +10,7 @@ measurements respectively.
## measurements ## measurements
The `measurements` property should hold the (named of the) measurements The `measurements` property should hold the names of the measurements
that are required to draft the current part. that are required to draft the current part.
```js ```js
@ -23,7 +23,7 @@ const part = {
## optionalMeasurements ## optionalMeasurements
The `optionalMeasurements` property should hold the (named of the) measurements The `optionalMeasurements` property should hold the names of the measurements
that are optional to draft the current part. that are optional to draft the current part.
```js ```js

View file

@ -10,7 +10,7 @@ Counters are for integers only. Things like number of buttons and so on.
Your counter option should be a plain object with these properties: Your counter option should be a plain object with these properties:
- `count` : The default integer value - `count` : The default integer value
- `min` : The minimal integer value that's allowed - `min` : The minimum integer value that's allowed
- `max` : The maximum integer value that's allowed - `max` : The maximum integer value that's allowed
<Tip> <Tip>

View file

@ -9,7 +9,7 @@ For angles, use a degree option.
Your degree option should be a plain object with these properties: Your degree option should be a plain object with these properties:
- `deg` : The default value in degrees - `deg` : The default value in degrees
- `min` : The minimul that's allowed - `min` : The minimum that's allowed
- `max` : The maximum that's allowed - `max` : The maximum that's allowed
<Tip> <Tip>
@ -28,9 +28,9 @@ more details.
```js ```js
options: { options: {
collarAngle: { collarAngle: {
deg: 85, deg: 85,
min: 60 min: 60,
max: 130 max: 130,
} }
} }
``` ```

View file

@ -68,4 +68,4 @@ percentage options][snapped] instead.
[list]: /reference/api/part/config/options/list [list]: /reference/api/part/config/options/list
[pct]: /reference/api/part/config/options/pct [pct]: /reference/api/part/config/options/pct
[snapped]: /reference/api/part/config/options/pct/snap [snapped]: /reference/api/part/config/options/pct/snap
[mm]: /reference/api/part/config/options/pct/mm [mm]: /reference/api/part/config/options/mm

View file

@ -30,10 +30,10 @@ options: {
dflt: "angledBarrelCuff", dflt: "angledBarrelCuff",
list: [ list: [
"roundedBarrelCuff", "roundedBarrelCuff",
"angledBarrelCuff" "angledBarrelCuff",
"straightBarrelCuff" "straightBarrelCuff",
"roundedFrenchCuff" "roundedFrenchCuff",
"angledFrenchCuff" "angledFrenchCuff",
"straightFrenchCuff" "straightFrenchCuff"
] ]
} }

View file

@ -2,16 +2,20 @@
title: Millimeter options title: Millimeter options
--- ---
<Warning>
While FreeSewing supports millimeter options, we recommend While FreeSewing supports millimeter options, we recommend
using [percentage options][1] and will not accept using [percentage options][1] and will not accept
contributions that use millimeter options. contributions that use millimeter options.
</Warning>
## Structure ## Structure
A millimeter option should be a plain object with these properties: A millimeter option should be a plain object with these properties:
- `mm` : The default value in millimeter - `mm` : The default value in millimeters
- `min` : The minimul that's allowed - `min` : The minimum that's allowed
- `max` : The maximum that's allowed - `max` : The maximum that's allowed
## Example ## Example

View file

@ -64,9 +64,9 @@ You can unlock those features by adding the following properties to your option:
- `toAbs`: A method to [return the option value in millimeter][toabs] - `toAbs`: A method to [return the option value in millimeter][toabs]
- `snap`: The configuration to control [snapping of percentage options][snap] - `snap`: The configuration to control [snapping of percentage options][snap]
[fromabs]: /reference/api/config/options/pct/fromabs [fromabs]: /reference/api/part/config/options/pct/fromabs
[toabs]: /reference/api/config/options/pct/toabs [toabs]: /reference/api/part/config/options/pct/toabs
[snap]: /reference/api/config/options/pct/snap [snap]: /reference/api/part/config/options/pct/snap
Refer to the relevant documentation for more details: Refer to the relevant documentation for more details:

View file

@ -91,4 +91,4 @@ it will also add a `toAbs()` method that does the inverse: return the
value in millimeter of whatever percentage the option is set to. value in millimeter of whatever percentage the option is set to.
See [Reporting a percentage option value in See [Reporting a percentage option value in
millimeter](/reference/api/config/options/pct/toabs) for details. millimeter](/reference/api/part/config/options/pct/toabs) for details.

View file

@ -90,7 +90,7 @@ of numbers.
The difference is that this allows you to supply a different list of snap values The difference is that this allows you to supply a different list of snap values
for users using metric or imperial units. for users using metric or imperial units.
In the example below, the value of [settings.units](/api/settings/units) will In the example below, the value of [settings.units](/reference/settings/units) will
determine which list of snap values gets used. determine which list of snap values gets used.
Then, if the absolute value returned by `toAbs()` is in the Then, if the absolute value returned by `toAbs()` is in the

View file

@ -81,4 +81,4 @@ also add a `fromAbs()` method that does the inverse: return the percentage of
any millimeter value passed into it. any millimeter value passed into it.
See [Setting a value in millimeter as a See [Setting a value in millimeter as a
percentage option](/api/config/options/pct/fromabs) for details. percentage option](/reference/api/part/config/options/pct/fromabs) for details.

View file

@ -34,7 +34,7 @@ access the following properties:
|| **_Access to utilities_** | || **_Access to utilities_** |
| `getId` | See [the getId documentation](/reference/api/part/getid) | | `getId` | See [the getId documentation](/reference/api/part/getid) |
| `hide` | See [the hide documentation](/reference/api/part/hide) | | `hide` | See [the hide documentation](/reference/api/part/hide) |
| `log` | See [the logging documentation](reference/api/store/logs) | | `log` | See [the logging documentation](/reference/api/store/log) |
| `macro` | See [the macros documentation](/reference/macros/) | | `macro` | See [the macros documentation](/reference/macros/) |
| `setHidden` | See [the setHidden documentation](/reference/api/part/sethidden) | | `setHidden` | See [the setHidden documentation](/reference/api/part/sethidden) |
| `store` | See [the store documentation](/reference/api/store) | | `store` | See [the store documentation](/reference/api/store) |

View file

@ -22,6 +22,11 @@ Path path.move(Point to)
paths.noline = new Path().move(points.to) paths.noline = new Path().move(points.to)
// Prevents clipping
paths.diag = new Path()
.move(new Point(40,19))
.move(new Point(70,21))
return part return part
} }
``` ```

View file

@ -2,7 +2,7 @@
title: Path.setText() title: Path.setText()
--- ---
The `Path.addText()` method set text on the path. The `Path.setText()` method sets text on the path.
## Signature ## Signature
@ -25,7 +25,7 @@ The second argument will optionally be used to set the CSS class for the text.
paths.line = new Path() paths.line = new Path()
.move(points.from) .move(points.from)
.line(points.to) .line(points.to)
.addText('FreeSewing rocks') .setText('FreeSewing rocks')
return part return part
} }

View file

@ -71,9 +71,11 @@ It just so happens that in most cases, there will be only one settings object in
- `Pattern.activePart`: Holds the id of the active part (while drafting) - `Pattern.activePart`: Holds the id of the active part (while drafting)
- `Pattern.activeSet`: Holds the id of the active set (while drafting) - `Pattern.activeSet`: Holds the id of the active set (while drafting)
- `Pattern.designConfig`: Holds the design's configuration - `Pattern.config`: Holds the resolved pattern's configuration
- `Pattern.designConfig`: Holds the design's configuration - `Pattern.designConfig`: Holds the design's configuration before resolution
- `Pattern.patternConfig`: Holds the pattern's configuration - `Pattern.parts`: Holds the parts used in the pattern
- `Pattern.plugins`: Holds the plugins used in the pattern
- `Pattern.settings`: Holds the settings used for the pattern
- `Pattern.store`: Holds the pattern-wide Store - `Pattern.store`: Holds the pattern-wide Store
- `Pattern.setStores`: Holds an array of stores, one for each set of settings. - `Pattern.setStores`: Holds an array of stores, one for each set of settings.

View file

@ -10,7 +10,7 @@ housekeeping tasks that are typically done behind the scenes when you call
return a Pattern's internal configuration. return a Pattern's internal configuration.
You can use this to see what options a pattern provides, what You can use this to see what options a pattern provides, what
measurments it requires, and so on. measurements it requires, and so on.
## Pattern.getConfig() signature ## Pattern.getConfig() signature

View file

@ -18,7 +18,7 @@ Pattern pattern.on(string hook, function method)
<Tip> <Tip>
Refer to [the Lifecycle hooks documentation](/reference/hooks/) for a list Refer to [the Lifecycle hooks documentation](/reference/hooks/) for a list
of all avaialble lifecycle hooks, as well as the signature of the function you of all availalble lifecycle hooks, as well as the signature of the function you
should pass it. should pass it.
</Tip> </Tip>

View file

@ -9,9 +9,9 @@ top of each other.
<Note>This method is chainable as it returns the Pattern object</Note> <Note>This method is chainable as it returns the Pattern object</Note>
Under the hood, this method will call one of Under the hood, this method will call one of
[Pattern.sampleOption()](/reference/apu/pattern/sampleoption), [Pattern.sampleOption()](/reference/api/pattern/sampleoption),
[Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption), or [Pattern.sampleMeasurement()](/reference/api/pattern/samplemeasurement), or
[Pattern.sampleModels()](/reference/apu/pattern/sampleoption) to sample [Pattern.sampleModels()](/reference/api/pattern/samplemodels) to sample
an option, a measurement, or different models respectively. an option, a measurement, or different models respectively.
Unlike those three methods where you pass the relevant info to to the method, Unlike those three methods where you pass the relevant info to to the method,
@ -27,9 +27,9 @@ The `settings.sample` object can hold the following properties:
See the specific sample methods below for more details: See the specific sample methods below for more details:
- [Pattern.sampleOption()](/reference/apu/pattern/sampleoption) - [Pattern.sampleOption()](/reference/api/pattern/sampleoption)
- [Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption) - [Pattern.sampleMeasurement()](/reference/api/pattern/samplemeasurement)
- [Pattern.sampleModels()](/reference/apu/pattern/sampleoption) - [Pattern.sampleModels()](/reference/api/pattern/samplemodels)
## Pattern.sample() signature ## Pattern.sample() signature

View file

@ -57,5 +57,5 @@ import { cisFemaleAdult } from "@freesewing/models"
const Aaron = new Aaron() const Aaron = new Aaron()
const svg = aaron.sampleModels(cisFemaleAdult, "34').render() const svg = aaron.sampleModels(cisFemaleAdult, "34").render()
``` ```

View file

@ -7,13 +7,13 @@ to draft multiple variants of the same pattern, and stack them on
top of each other. top of each other.
In this particular case, the variants it drafts depend In this particular case, the variants it drafts depend
on [the type of option](/config/options/): on [the type of option](/reference/api/part/config/options/):
- For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max - For a Percentage or Degree option, 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 a Counter or Millimeter option, a maximum of 10 steps will be sampled, between min and max
- For options with a **list** of options, each option in the list will be sampled - For a Constant numeric option, 10 steps will be sampled between 90% and 110% of the value
- For a List option, each option in the list will be sampled
<Fixme>Handle other option types</Fixme> - For a Boolean option, both `false` and `true` will be sampled
<Tip> <Tip>
The goal of option sampling is to verify the impact of an option on the pattern, and verify that The goal of option sampling is to verify the impact of an option on the pattern, and verify that
@ -38,5 +38,5 @@ const pattern = new Aaron({
measurements: cisFemaleAdult34 measurements: cisFemaleAdult34
}) })
const svg = pattern.draft().sampleMeasurement('chest') const svg = pattern.draft().sampleOption('backlineBend')
``` ```

View file

@ -26,6 +26,11 @@ float point.dy(Point point)
.setClass("dotted") .setClass("dotted")
.setText(units(points.from.dy(points.to)), 'center') .setText(units(points.from.dy(points.to)), 'center')
// Prevents clipping
paths.diag = new Path()
.move(new Point(-10,40))
.move(new Point(60,10))
return part return part
} }
``` ```

View file

@ -21,7 +21,7 @@ Point objects come with the following properties:
- `x` : The X-coordinate of the point - `x` : The X-coordinate of the point
- `y` : The Y-coordinate of the point - `y` : The Y-coordinate of the point
- `attributes` : An [Attributes](../attributes) instance holding the point's attributes - `attributes` : An [Attributes](/reference/api/attributes) instance holding the point's attributes
## Example ## Example

View file

@ -16,7 +16,7 @@ Point point.rotate(float angle, Point center)
## Example ## Example
<Example caption="An example of the4Point.rotate() method"> <Example caption="An example of the Point.rotate() method">
```js ```js
({ Point, points, Path, paths, Snippet, snippets, part }) => { ({ Point, points, Path, paths, Snippet, snippets, part }) => {

View file

@ -25,7 +25,7 @@ Point point.setCircle(
## Example ## Example
<Example caption="Examples of Point.setCircle(), compare this to [Point.addCircle](/reference/api/point/addcircle)"> <Example caption="Examples of Point.setCircle(), compare this to [Point.addCircle()](/reference/api/point/addcircle)">
```js ```js
({ Point, points, part }) => { ({ Point, points, part }) => {

View file

@ -19,7 +19,7 @@ Point point.setText(
## Example ## Example
<Example caption="Examples of Point.setText(), compare this to [Point.setText](/reference/api/point/settext)"> <Example caption="Examples of Point.setText(), compare this to [Point.setText()](/reference/api/point/settext)">
```js ```js
({ Point, points, Path, paths, part }) => { ({ Point, points, Path, paths, part }) => {

View file

@ -32,7 +32,7 @@ will run `myCustomMethod()`.
## Methods ## Methods
A Store object exposes the following methods: A Store object exposes the following methods and properties:
<ReadMore list /> <ReadMore list />
@ -42,4 +42,6 @@ A store is typically used to share information between parts. For example
the length of the neck opening in one part can be used to calculate the the length of the neck opening in one part can be used to calculate the
length for the collar in another part. length for the collar in another part.
<Fixme compact>Include link to guide</Fixme> Click below to learn more about:
- [How Stores work](/guides/patterns/store)

View file

@ -15,5 +15,5 @@ null hook(Svg svg)
The `postRender` hook is rarely used, but it's there if you need it. The `postRender` hook is rarely used, but it's there if you need it.
Like the `preRender` hook, it receives [the SVG object](/api/svg) as its first Like the `preRender` hook, it receives [the SVG object](/reference/api/svg) as its first
parameter. parameter.

View file

@ -16,5 +16,5 @@ null hook(Svg svg)
The `preRender` hook is typically used to change the result of the render, for The `preRender` hook is typically used to change the result of the render, for
example by adding CSS to the SVG output. example by adding CSS to the SVG output.
Like the `postRender` hook, it receives [the SVG object](/api/svg) as its first Like the `postRender` hook, it receives [the SVG object](/reference/api/svg) as its first
parameter. parameter.

View file

@ -50,3 +50,9 @@ macro('banner', {
| `dy` | `1` | `number` | Controls how far the text will be located above the path | | `dy` | `1` | `number` | Controls how far the text will be located above the path |
| `spaces` | `12` | `number` | The number of spaces to place between repetitions | | `spaces` | `12` | `number` | The number of spaces to place between repetitions |
| `repeat` | `10` | `number` | The number of repetitions | | `repeat` | `10` | `number` | The number of repetitions |
## Notes
Under the hood, this macro will:
- Add `data-text`, `data-text-dy`, and `data-text-class` Attributes to the path to generate the text.

View file

@ -43,6 +43,12 @@ macro('banner', {
| `angle` | `0` | `number` | The angle under which to draw the bartack | | `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are togeter | | `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack | | `length` | `15` | `number` | Length of the bartack |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points | | `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points | | `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack | | `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -49,6 +49,12 @@ macro('banner', {
| `density` | `3` | `number` | Controls how close the stitches are togeter | | `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack | | `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow | | `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points | | `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points | | `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack | | `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -54,7 +54,13 @@ macro('banner', {
| `end` | `1` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack end | | `end` | `1` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack end |
| `length` | `15` | `number` | Length of the bartack | | `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow | | `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points | | `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `start` | `0` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack start | | `start` | `0` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack start |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points | | `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack | | `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -22,7 +22,7 @@ macro('cutonfold', {
<Example caption="Example of the cut on fold indicator added by this macro"> <Example caption="Example of the cut on fold indicator added by this macro">
```js ```js
({ Point, macro, part }) => { ({ Point, macro, Path, paths, part }) => {
macro('cutonfold', { macro('cutonfold', {
from: new Point(0,0), from: new Point(0,0),
@ -30,6 +30,11 @@ macro('cutonfold', {
grainline: true grainline: true
}) })
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(110,0))
return part return part
} }
``` ```
@ -43,8 +48,19 @@ macro('cutonfold', {
| `to` | | [Point](/reference/api/point) | The endpoint of the _cut on fold_ indicator | | `to` | | [Point](/reference/api/point) | The endpoint of the _cut on fold_ indicator |
| `margin` | 5 | [Point](/reference/api/point) | The distance in % to keep from the start/end edge | | `margin` | 5 | [Point](/reference/api/point) | The distance in % to keep from the start/end edge |
| `offset` | 15 | Number | The distance in mm to offset from the line from start to end | | `offset` | 15 | Number | The distance in mm to offset from the line from start to end |
| `prefix` | | String | A prefix to apply to the names of the generated path and points |
| `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline | | `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.cutonfold${prefix}` | The Path for the _cut on fold_ indicator |
| `points.cutonfoldFrom${prefix}` | Point used to create the path |
| `points.cutonfoldVia1${prefix}` | Point used to create the path |
| `points.cutonfoldVia2${prefix}` | Point used to create the path |
| `points.cutonfoldTo${prefix}` | Point used to create the path |
## Notes ## Notes
### It's safe to use a corner of your pattern part for this ### It's safe to use a corner of your pattern part for this

View file

@ -46,4 +46,4 @@ 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 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 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 the Snippets in your Part and multiply the (X or Y)-coordinate of the anchor point by -1
- Add a 'flipped` Attribute to Points and Paths to keep track of the number of times they have been flipped (to avoid issues when multiple flips are performed)

View file

@ -2,8 +2,7 @@
title: gore title: gore
--- ---
The `gore` macro facilitates the drafting of [gores][1] which are typically The `gore` macro facilitates the drafting of [gores][1] to create spherical or other roundish objects. They are are typically used in hats.
used in hats.
It is provided by the [gore plugin](/reference/plugins/grainline/). It is provided by the [gore plugin](/reference/plugins/grainline/).
## Signature ## Signature
@ -16,6 +15,7 @@ macro('gore', {
Number extraLength, Number extraLength,
Boolean hidden=true, Boolean hidden=true,
String class='', String class='',
String prefix='',
) )
``` ```
@ -45,10 +45,22 @@ macro('gore', {
|--------------:|---------|------------|----------------------------------------------| |--------------:|---------|------------|----------------------------------------------|
| `from` | | [Point][2] | The point to start drafting the gore from | | `from` | | [Point][2] | The point to start drafting the gore from |
| `radius` | | number | The radius of the sphere the gores should cover | | `radius` | | number | The radius of the sphere the gores should cover |
| `gores` | | number | The text to put on the _grainline_ indicator | | `gores` | | number | The number of gores into which the sphere is divided |
| `extraLength` | | number | The length of the straight section after a complete semisphere | | `extraLength` | | number | The length of the straight section after a complete semisphere |
| `hidden` | `true` | boolean | Whether or not to hide the generated path | | `hidden` | `true` | boolean | Whether or not to hide the generated path |
| `class` | | boolean | Any classes to add to the generated path | | `class` | | boolean | Any classes to add to the generated path |
| `prefix` | | string | A prefix to apply to the names of the generated path and points |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.${prefix}seam` | The Path for the gore |
| `points.${prefix}p1` | Point for the gore tip |
| `points.${prefix}p2` | Point between the tip and side corner |
| `points.${prefix}p3` | Point for the gore side corner |
| `points.${prefix}Cp1` | Control Point used to create the curved path |
| `points.${prefix}Cp2` | Control Point used to create the curved path |
[1]: https://en.wikipedia.org/wiki/Gore_\(segment\) [1]: https://en.wikipedia.org/wiki/Gore_\(segment\)

View file

@ -2,7 +2,7 @@
title: grainline title: grainline
--- ---
The `grainline` macro adds a _grainline_ indicator to your pattern. The `grainline` macro adds a _grainline_ indicator to your pattern.
It is provided by the [grainline plugin](/reference/plugins/grainline/). It is provided by the [grainline plugin](/reference/plugins/grainline/).
## Signature ## Signature
@ -19,19 +19,23 @@ macro('grainline', {
<Example caption="Example of the grainline indicator added by this macro"> <Example caption="Example of the grainline indicator added by this macro">
```js ```js
({ Point, macro, part }) => { ({ Point, macro, Path, paths, part }) => {
macro('grainline', { macro('grainline', {
from: new Point(0,0), from: new Point(0,0),
to: new Point(100,0), to: new Point(100,0),
}) })
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,-10))
.move(new Point(110, 0))
return part return part
} }
``` ```
</Example> </Example>
## Configuration ## Configuration
| Property | Default | Type | Description | | Property | Default | Type | Description |
@ -40,6 +44,14 @@ macro('grainline', {
| `to` | | [Point][1] | The endpoint of the _grainline_ indicator | | `to` | | [Point][1] | The endpoint of the _grainline_ indicator |
| `text` | 'grainline' | string | The text to put on the _grainline_ indicator | | `text` | 'grainline' | string | The text to put on the _grainline_ indicator |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.grainline` | The Path for the _grainline_ indicator |
| `points.grainlineFrom` | Point used to create the path |
| `points.grainlineTo` | Point used to create the path |
[1]: /reference/api/point [1]: /reference/api/point
## Notes ## Notes

View file

@ -11,7 +11,7 @@ It is provided by the [dimension plugin](/reference/plugins/dimension/).
macro('hd', { macro('hd', {
String id, String id,
Point from, Point from,
Boolean noEndtMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Point to, Point to,
@ -43,11 +43,19 @@ macro('hd', {
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension | | `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension | | `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `y` | | Number | The Y-value at which to draw the dimension | | `y` | | Number | The Y-value at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created | | `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `text` | Horizontal distance | Number | The text to go on the dimension if not the from-to horizontal distance | | `text` | Horizontal distance | Number | The text to go on the dimension if not the from-to horizontal distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: Setting a custom ID will:

View file

@ -2,7 +2,7 @@
title: ld title: ld
--- ---
The `ld` macro adds a _linear dimension_ to your pattern. The `ld` macro adds a _linear dimension_ to your pattern.
It is provided by the [dimension plugin](/reference/plugins/dimension/). It is provided by the [dimension plugin](/reference/plugins/dimension/).
## Signature ## Signature
@ -12,7 +12,7 @@ macro('ld', {
Number d, Number d,
String id, String id,
Point from, Point from,
Boolean noEndtMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Point to, Point to,
@ -39,14 +39,22 @@ macro('ld', {
## Configuration ## Configuration
| Property | Default | Type | Description | | Property | Default | Type | Description |
|-----------------|---------|---------------------|-------------| |----------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension | | `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension | | `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `d` | 0 | Number | The offset at which to draw the dimension | | `d` | 0 | Number | The offset at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created | | `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `text` | Linear distance | Number | The text to go on the dimension if not the from-to linear distance | | `text` | Linear distance | Number | The text to go on the dimension if not the from-to linear distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes

View file

@ -4,6 +4,8 @@ title: miniscale
The `miniscale` macro adds a mini _scale box_ to your pattern. This box allows The `miniscale` macro adds a mini _scale box_ to your pattern. This box allows
users to verify their pattern is printed to scale. users to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale.
The `miniscale` macro is provided by the [scalebox plugin](/reference/plugins/scalebox). The `miniscale` macro is provided by the [scalebox plugin](/reference/plugins/scalebox).
It is the mini version of [the scalebox macro](/reference/macros/scalebox/). It is the mini version of [the scalebox macro](/reference/macros/scalebox/).
@ -35,10 +37,20 @@ macro('miniscale', {
## Configuration ## Configuration
| Property | Default | Type | Description | | Property | Default | Type | Description |
|-------------|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on | | `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `rotate` | 0 | Number | Rotation in degrees | | `rotate` | 0 | Number | Rotation in degrees |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.__miniscaleImperial` | Path of the imperial, outer box |
| `paths.__miniscaleMetric` | Path of the metric, inner box |
| `points.__miniscaleImperial` | Point anchoring the imperial text |
| `points.__miniscaleMetric` | Point anchoring the metric text |
| `points.__miniscale[Metric/Imperial][Top/Bottom][Left/Right]` | Points for the corners of the boxes |
## Notes ## Notes
If you inherit a part with a miniscale on it and you'd like to remove all If you inherit a part with a miniscale on it and you'd like to remove all

View file

@ -53,7 +53,17 @@ macro('mirror', {
|-------------:|------------|------------|-------------| |-------------:|------------|------------|-------------|
| `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the _mirror line_ | | `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the _mirror line_ |
| `clone` | `true` | `bool` | Whether to clone mirrored points and or paths | | `clone` | `true` | `bool` | Whether to clone mirrored points and or paths |
| `points` | | `array` | An array of [Point](/reference/api/point) objects | | `points` | | `array` | An array of pointnames, the names of Points in the `points` array to mirror |
| `paths` | | `array` | An array of [Path](/reference/api/path) objects | | `paths` | | `array` | An array of pathnames, the names of Paths in the `paths` array to mirror |
| `prefix` | `mirrored` | `string` | A prefix to apply to the names of the clones points and or paths. Ignored if `nameFormat` is set | | `prefix` | `mirrored` | `string` | A prefix to apply to the names of the clones points and or paths. Ignored if `nameFormat` is set |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point | | `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |
## Result
If `nameFormat` is set, its method determines the names of cloned, mirrored Points and Paths.
If it is not set, the names are as below.
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}${Pathname}` | The cloned, mirrored Path(s) (with the first letter of pathname capitalized) |
| `points.${prefix}${Pointname}` | The cloned, mirrored Point(s) (with the first letter of pointname capitalized) |

View file

@ -13,7 +13,7 @@ macro('pd', {
Number d, Number d,
String id, String id,
Path path, Path path,
Boolean noEndtMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
}) })
@ -44,12 +44,20 @@ macro('pd', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------| |----------------:|---------|---------------------|-------------|
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along | | `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
| `d` | 0 | Number | The offset at which to draw the dimension | | `d` | 10 | Number | The offset at which to draw the dimension |
| `text` | Path length | Number | The text to go on the dimension if not the length of the path | | `text` | Path length | Number | The text to go on the dimension if not the length of the path |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created | | `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: Setting a custom ID will:

View file

@ -2,7 +2,7 @@
title: round title: round
--- ---
The `round` macro rounds a corner. It is provided by the [round The `round` macro creates a rounded corner. It is provided by the [round
plugin](/reference/plugins/round/). plugin](/reference/plugins/round/).
## Signature ## Signature
@ -44,12 +44,22 @@ macro('round', {
|------------:|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint towards the corner to round | | `from` | | [Point](/reference/api/point) | The startpoint towards the corner to round |
| `to` | | [Point](/reference/api/point) | The endpoint away from the corner to round | | `to` | | [Point](/reference/api/point) | The endpoint away from the corner to round |
| `via` | | [Point](/reference/api/point) | The corner to round | | `via` | | [Point](/reference/api/point) | The cornerpoint to round |
| `radius` | Maximum | Number | The radius in mm in not the maximum | | `radius` | Maximum | Number | The radius in mm if not the maximum possible |
| `prefix` | | String | A prefix to give to the points and paths created by this macro | | `prefix` | | String | A prefix to give to the points and paths created by this macro |
| `hide` | `true` | Boolean | Whether to hide the path created by this macro | | `hide` | `true` | Boolean | Whether to hide the path created by this macro |
| `class` | | String | Class(es) to assign to the path created by this macro | | `class` | | String | Class(es) to assign to the path created by this macro |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}Rounded` | Path for the rounded corner |
| `points.${prefix}Start` | Point for the start of the rounded corner |
| `points.${prefix}End` | Point for the end of the rounded corner |
| `points.${prefix}Cp1` | Control Point used to create the curved path |
| `points.${prefix}Cp2` | Control Point used to create the curved path |
## Notes ## Notes
This macro is only intended for 90 degree corners. This macro is only intended for 90 degree corners.

View file

@ -4,6 +4,8 @@ title: scalebox
The `scalebox` macro adds a _scale box_ to your pattern. This box allows users The `scalebox` macro adds a _scale box_ to your pattern. This box allows users
to verify their pattern is printed to scale. to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale.
The `scalebox` macro is provided by the [scalebox The `scalebox` macro is provided by the [scalebox
plugin](/reference/plugins/scalebox). plugin](/reference/plugins/scalebox).
@ -40,7 +42,7 @@ macro('scalebox', {
## Configuration ## Configuration
| Property | Default | Type | Description | | Property | Default | Type | Description |
|-------------|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on | | `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `lead` | FreeSewing | String | The lead text above the title | | `lead` | FreeSewing | String | The lead text above the title |
| `title` | _pattern name + version_ | String | The title text | | `title` | _pattern name + version_ | String | The title text |
@ -49,6 +51,19 @@ macro('scalebox', {
(\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons` (\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons`
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.__scaleboxImperial` | Path of the imperial, outer box |
| `paths.__scaleboxMetric` | Path of the metric, inner box |
| `points.__scaleboxLead` | Point anchoring the lead text above the title |
| `points.__scaleboxTitle` | Point anchoring the title text |
| `points.__scaleboxTitle` | Point anchoring the text below the title |
| `points.__scaleboxImperial` | Point anchoring the imperial text |
| `points.__scaleboxMetric` | Point anchoring the metric text |
| `points.__scalebox[Metric/Imperial][Top/Bottom][Left/Right]` | Points for the corners of the boxes |
## Notes ## Notes
### Removing the scalebox ### Removing the scalebox

View file

@ -2,8 +2,8 @@
title: sprinkle title: sprinkle
--- ---
The `sprinkle` macro facilitates adding snippets to your pattern in bulk. The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is by the [sprinkle plugin](/reference/plugins/sprinkle). It is provided by the [sprinkle plugin](/reference/plugins/sprinkle).
## Signature ## Signature
@ -38,7 +38,7 @@ macro('sprinkle', {
// Prevent clipping // Prevent clipping
paths.diag = new Path() paths.diag = new Path()
.move(points.a) .move(points.a)
.move(points.g) .move(new Point(points.g.x, points.g.y + 5))
return part return part
} }
@ -49,7 +49,13 @@ macro('sprinkle', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|------------:|---------|------------------|-------------| |------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the snippet to sprinkle | | `snippet` | | String | Name of the Snippet to sprinkle |
| `on` | `[]` | Array of strings | An array with **the names** of points to add the snippet on | | `on` | `[]` | Array of strings | Array of pointnames, the names of Points in the `points` array to add the Snippets on |
| `scale` | 1 | number | Scale for the individual snippets | | `scale` | 1 | number | Scale for the individual Snippets |
| `rotate` | 0 | number | Rotation for the individual snippets | | `rotate` | 0 | number | Rotation for the individual Snippets |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `snippets.${pointname}-${snippet}` | The Snippet(s) created |

View file

@ -2,7 +2,7 @@
title: title title: title
--- ---
The `title` macro adds a title to a pattern part. The `title` macro adds a title to a pattern part.
It is provided by the [title plugin](/reference/plugins/title). It is provided by the [title plugin](/reference/plugins/title).
## Signature ## Signature
@ -25,9 +25,10 @@ macro('title', {
```js ```js
({ Point, Path, paths, macro, store, part }) => { ({ Point, Path, paths, macro, store, part }) => {
// This is where name/version is supposed to be stored // This is where name/version/etc. is supposed to be stored
store.set('data.version', 3) store.set('data.version', 3)
store.set('data.name', 'Example') store.set('data.name', 'Example')
store.set('data.for', 'Person')
macro('title', { macro('title', {
nr: 9, nr: 9,
@ -37,8 +38,8 @@ macro('title', {
// Prevent clipping // Prevent clipping
paths.diag = new Path() paths.diag = new Path()
.move(new Point(0,-50)) .move(new Point(-20,-50))
.move(new Point(80,20)) .move(new Point(80,35))
return part return part
} }
@ -56,3 +57,13 @@ macro('title', {
| `append` | `false` | Boolean | Set this to `true` to append the `nr` to any text already set in Point `at`'s attributes, rather than overwrite it | | `append` | `false` | Boolean | Set this to `true` to append the `nr` to any text already set in Point `at`'s attributes, rather than overwrite it |
| `rotation` | 0 | Number | An optional rotation in degrees | | `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor | | `scale` | 1 | Number | An optional scaling factor |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `points._${prefix}_titleNr` | Point anchoring the part number text |
| `points._${prefix}_titleName` | Point anchoring the part name text |
| `points._${prefix}_titlePattern` | Point anchoring the pattern name text |
| `points._${prefix}_titleFor` | Point anchoring the name of the person for whom the pattern was made, if that information exists |
| `points._${prefix}_exportDate` | Point anchoring the pattern export date |

View file

@ -2,7 +2,7 @@
title: vd title: vd
--- ---
The `vd` macro adds a _vertical dimension_ to your pattern. The `vd` macro adds a _vertical dimension_ to your pattern.
It is provided by the [dimension plugin](/reference/plugins/dimension/). It is provided by the [dimension plugin](/reference/plugins/dimension/).
## Signature ## Signature
@ -11,7 +11,7 @@ It is provided by the [dimension plugin](/reference/plugins/dimension/).
macro('vd', { macro('vd', {
String id, String id,
Point from, Point from,
Boolean noEndtMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Point to, Point to,
@ -23,7 +23,7 @@ macro('vd', {
<Example caption="An example of a vertical dimension with the vd macro"> <Example caption="An example of a vertical dimension with the vd macro">
```js ```js
({ Point, macro, part }) => { ({ Point, macro, Path, paths, part }) => {
macro('vd', { macro('vd', {
from: new Point(0,0), from: new Point(0,0),
@ -31,6 +31,11 @@ macro('vd', {
x:10, x:10,
}) })
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,0))
.move(new Point(90,40))
return part return part
} }
``` ```
@ -44,10 +49,18 @@ macro('vd', {
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension | | `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `x` | | Number | The X-value at which to draw the dimension | | `x` | | Number | The X-value at which to draw the dimension |
| `text` | Vertical distance | Number | The text to go on the dimension if not the from-to vertical distance | | `text` | Vertical distance | Number | The text to go on the dimension if not the from-to vertical distance |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created | | `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: Setting a custom ID will:

View file

@ -54,8 +54,8 @@ You can see this in practice in our [Carlita][2] pattern, which extends the
menswear [Carlton][3] pattern. menswear [Carlton][3] pattern.
<Related compact> <Related compact>
To learn more about extending a pattern, see [Design To learn more about extending a pattern, see [Part
inheritance](/howtos/code/inheritance/) inheritance](/howtos/code/from/)
</Related> </Related>
### Use when creating gender-neutral patterns ### Use when creating gender-neutral patterns
@ -65,17 +65,17 @@ if they are present — you can use this plugin, but you'll also need a few othe
things: things:
- You'll need to mark the breast measurements as [optional - You'll need to mark the breast measurements as [optional
measurements](/reference/api/config/optionalmeasurements) measurements](/reference/api/part/config/measurements#optionalmeasurements)
- You'll need to [conditionally load this - You'll need to [conditionally load this
plugin](/guides/plugins/conditionally-loading-build-time-plugins) plugin](/reference/api/part/config/plugins#conditional-plugins)
You can see an example of this in [our Teagan design][4]. You can see an example of this in [our Teagan design][4].
[1]: https://www.npmjs.com/package/@freesewing/plugin-banner [1]: https://www.npmjs.com/package/@freesewing/plugin-banner
[2]: https://github.com/freesewing/freesewing/blob/develop/designs/carlita/src/index.js#L12 [2]: https://github.com/freesewing/freesewing/blob/develop/designs/carlita/src/index.mjs#L25
[3]: https://github.com/freesewing/freesewing/blob/develop/designs/carlton [3]: https://github.com/freesewing/freesewing/blob/develop/designs/carlton
[4]: https://github.com/freesewing/freesewing/blob/develop/designs/teagan/src/index.js [4]: https://github.com/freesewing/freesewing/blob/develop/designs/teagan/src/index.mjs

View file

@ -778,17 +778,18 @@ Pattern.prototype.__isStackHidden = function (stackName) {
} }
/** /**
* Generates an array of settings.options objects for sampling a list option * Generates an array of settings.options objects for sampling a list or boolean option
* *
* @private * @private
* @param {string} optionName - Name of the option to sample * @param {string} optionName - Name of the option to sample
* @return {Array} sets - The list of settings objects * @return {Array} sets - The list of settings objects
*/ */
Pattern.prototype.__listOptionSets = function (optionName) { Pattern.prototype.__listBoolOptionSets = function (optionName) {
let option = this.config.options[optionName] let option = this.config.options[optionName]
const base = this.__setBase() const base = this.__setBase()
const sets = [] const sets = []
let run = 1 let run = 1
if (typeof option.bool !== 'undefined') option = { list: [false, true] }
for (const choice of option.list) { for (const choice of option.list) {
const settings = { const settings = {
...base, ...base,
@ -1091,11 +1092,15 @@ Pattern.prototype.__needs = function (partName, set = 0) {
* @return {Array} sets - The list of settings objects * @return {Array} sets - The list of settings objects
*/ */
Pattern.prototype.__optionSets = function (optionName) { Pattern.prototype.__optionSets = function (optionName) {
let option = this.config.options[optionName]
if (typeof option?.list === 'object') return this.__listOptionSets(optionName)
const sets = [] const sets = []
if (!(optionName in this.config.options)) return sets
let option = this.config.options[optionName]
if (typeof option.list === 'object' || typeof option.bool !== 'undefined')
return this.__listBoolOptionSets(optionName)
let factor = 1 let factor = 1
let step, val let step, val
let numberRuns = 10
let stepFactor = numberRuns - 1
if (typeof option.min === 'undefined' || typeof option.max === 'undefined') { if (typeof option.min === 'undefined' || typeof option.max === 'undefined') {
const min = option * 0.9 const min = option * 0.9
const max = option * 1.1 const max = option * 1.1
@ -1103,9 +1108,16 @@ Pattern.prototype.__optionSets = function (optionName) {
} }
if (typeof option.pct !== 'undefined') factor = 100 if (typeof option.pct !== 'undefined') factor = 100
val = option.min / factor val = option.min / factor
step = (option.max / factor - val) / 9 if (typeof option.count !== 'undefined' || typeof option.mm !== 'undefined') {
const numberOfCounts = option.max - option.min + 1
if (numberOfCounts < 10) {
numberRuns = numberOfCounts
stepFactor = Math.max(numberRuns - 1, 1)
}
}
step = (option.max / factor - val) / stepFactor
const base = this.__setBase() const base = this.__setBase()
for (let run = 1; run < 11; run++) { for (let run = 1; run <= numberRuns; run++) {
const settings = { const settings = {
...base, ...base,
options: { options: {
@ -1117,6 +1129,8 @@ Pattern.prototype.__optionSets = function (optionName) {
settings.options[optionName] = val settings.options[optionName] = val
sets.push(settings) sets.push(settings)
val += step val += step
if (typeof option.count !== 'undefined' || typeof option.mm !== 'undefined')
val = Math.round(val)
} }
return sets return sets

View file

@ -320,7 +320,7 @@ Point.prototype.sitsRoughlyOn = function (that) {
* Returns slope of a line made by this Point and that Point * Returns slope of a line made by this Point and that Point
* *
* @param {Point} that - The Point that forms the line together with this Point * @param {Point} that - The Point that forms the line together with this Point
* @return {float} slote - The slope of the line made by this Point and that Point * @return {float} slope - The slope of the line made by this Point and that Point
*/ */
Point.prototype.slope = function (that) { Point.prototype.slope = function (that) {
return (that.__check().y - this.__check().y) / (that.x - this.x) return (that.__check().y - this.__check().y) / (that.x - this.x)

View file

@ -44,7 +44,7 @@ export function beamIntersectsCircle(c, r, p1, p2, sort = 'x') {
} }
/** /**
* Finds qhere an endless line intersects with a given X-value * Finds where an endless line intersects with a given X-value
* *
* @param {Point} from - First Point on the line * @param {Point} from - First Point on the line
* @param {Point} to - Second Point on the line * @param {Point} to - Second Point on the line
@ -60,7 +60,7 @@ export function beamIntersectsX(from, to, x) {
} }
/** /**
* Finds qhere an endless line intersects with a given Y-value * Finds where an endless line intersects with a given Y-value
* *
* @param {Point} from - First Point 1 on the line * @param {Point} from - First Point 1 on the line
* @param {Point} to - Second Point on the line * @param {Point} to - Second Point on the line
@ -162,7 +162,7 @@ export function circlesIntersect(c1, r1, c2, r2, sort = 'x') {
* @param {BezierJs} curve - A BezierJs curve instance * @param {BezierJs} curve - A BezierJs curve instance
* @param {string} edge - The edge to find: top, bottom, right, or left * @param {string} edge - The edge to find: top, bottom, right, or left
* @param {int} steps - The number of steps to divide the curve in while walking it * @param {int} steps - The number of steps to divide the curve in while walking it
* @return {Array} intersecions - An Array of Point objects of all intersections * @return {Point} edgepoint - A Point object located on the edge of the curve. Returns the first point found, if more than one lies on the edge.
*/ */
export function curveEdge(curve, edge, steps = 500) { export function curveEdge(curve, edge, steps = 500) {
let x = Infinity let x = Infinity
@ -194,7 +194,7 @@ export function curveEdge(curve, edge, steps = 500) {
* @param {Point} cp2 - Control Point at the end of the curve * @param {Point} cp2 - Control Point at the end of the curve
* @param {Point} to - End Point of the curve * @param {Point} to - End Point of the curve
* @param {float} x - X-value to check for intersections * @param {float} x - X-value to check for intersections
* @return {Array} intersecions - An Array of Point objects of all intersections * @return {Array} intersections - An Array of Point objects of all intersections
*/ */
export function curveIntersectsX(from, cp1, cp2, to, x) { export function curveIntersectsX(from, cp1, cp2, to, x) {
let start = new Point(x, -10000) let start = new Point(x, -10000)
@ -210,7 +210,7 @@ export function curveIntersectsX(from, cp1, cp2, to, x) {
* @param {Point} cp2 - Control Point at the end of the curve * @param {Point} cp2 - Control Point at the end of the curve
* @param {Point} to - End Point of the curve * @param {Point} to - End Point of the curve
* @param {float} y - Y-value to check for intersections * @param {float} y - Y-value to check for intersections
* @return {Array} intersecions - An Array of Point objects of all intersections * @return {Array} intersections - An Array of Point objects of all intersections
*/ */
export function curveIntersectsY(from, cp1, cp2, to, y) { export function curveIntersectsY(from, cp1, cp2, to, y) {
let start = new Point(-10000, y) let start = new Point(-10000, y)
@ -229,7 +229,7 @@ export function curveIntersectsY(from, cp1, cp2, to, y) {
* @param {Point} cp1B - Control Point at the start of the second curve * @param {Point} cp1B - Control Point at the start of the second curve
* @param {Point} cp2B - Control Point at the end of the second curve * @param {Point} cp2B - Control Point at the end of the second curve
* @param {Point} toB - End Point of the fsecond curve * @param {Point} toB - End Point of the fsecond curve
* @return {Array} intersecions - An Array of Point objects of all intersections between the curves * @return {Array} intersections - An Array of Point objects of all intersections between the curves
*/ */
export function curvesIntersect(fromA, cp1A, cp2A, toA, fromB, cp1B, cp2B, toB) { export function curvesIntersect(fromA, cp1A, cp2A, toA, fromB, cp1B, cp2B, toB) {
let precision = 0.005 // See https://github.com/Pomax/bezierjs/issues/99 let precision = 0.005 // See https://github.com/Pomax/bezierjs/issues/99

View file

@ -37,7 +37,7 @@
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.orderby": "^4.6.0", "lodash.orderby": "^4.6.0",
"lodash.set": "^4.3.2", "lodash.set": "^4.3.2",
"next": "^13", "next": "^13.0.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-copy-to-clipboard": "^5.0.4", "react-copy-to-clipboard": "^5.0.4",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",

View file

@ -41,13 +41,16 @@
"d3-drag": "^3.0.0", "d3-drag": "^3.0.0",
"d3-selection": "^3.0.0", "d3-selection": "^3.0.0",
"daisyui": "^2.0.6", "daisyui": "^2.0.6",
"i18next": "^22.4.0",
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.orderby": "^4.6.0", "lodash.orderby": "^4.6.0",
"lodash.set": "^4.3.2", "lodash.set": "^4.3.2",
"next": "latest", "next": "^13.0.0",
"next-i18next": "^13.0.0", "next-i18next": "^13.0.0",
"react": "^18.2.0",
"react-copy-to-clipboard": "^5.0.4", "react-copy-to-clipboard": "^5.0.4",
"react-hotkeys-hook": "^4.0.4", "react-hotkeys-hook": "^4.0.4",
"react-i18next": "^12.1.1",
"react-instantsearch-dom": "^6.18.0", "react-instantsearch-dom": "^6.18.0",
"react-markdown": "^8.0.0", "react-markdown": "^8.0.0",
"react-swipeable": "^7.0.0", "react-swipeable": "^7.0.0",

View file

@ -40,7 +40,7 @@
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.orderby": "^4.6.0", "lodash.orderby": "^4.6.0",
"lodash.set": "^4.3.2", "lodash.set": "^4.3.2",
"next": "latest", "next": "^13.0.0",
"react-hotkeys-hook": "^4.0.4", "react-hotkeys-hook": "^4.0.4",
"react-instantsearch-dom": "^6.18.0", "react-instantsearch-dom": "^6.18.0",
"react-markdown": "^8.0.3", "react-markdown": "^8.0.3",

1076
yarn.lock

File diff suppressed because it is too large Load diff