chore: Linting for markdown and js
This commit is contained in:
parent
eca8199ed8
commit
1c92e0f655
6677 changed files with 24391 additions and 25987 deletions
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: add()
|
||||
---
|
||||
***
|
||||
|
||||
## title: add()
|
||||
|
||||
```js
|
||||
Attributes attributes.add(string key, string value)
|
||||
|
@ -8,7 +8,7 @@ Attributes attributes.add(string key, string value)
|
|||
|
||||
Adds `value` to the attribute identified by `key`.
|
||||
|
||||
Adding multiple values to the same key will result in them being joined together
|
||||
Adding multiple values to the same key will result in them being joined together
|
||||
(with a space) when rendering.
|
||||
|
||||
```js
|
||||
|
@ -28,4 +28,3 @@ paths.demo = new Path()
|
|||
paths.demo = new Path()
|
||||
.attr('class', 'classA classB');
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: clone()
|
||||
---
|
||||
***
|
||||
|
||||
## title: clone()
|
||||
|
||||
```js
|
||||
Attributes attributes.clone()
|
||||
|
@ -17,4 +17,3 @@ paths.demo = new Path()
|
|||
|
||||
paths.clone = paths.demo.clone()
|
||||
```
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Attributes
|
||||
order: 40
|
||||
---
|
||||
---------
|
||||
|
||||
Attributes is an object that holds attributes for a variety of other objects.
|
||||
|
||||
Attributes are attached to [`Point`](/reference/api/point), [`Path`](/reference/api/path), and [`Snippet`](/reference/api/snippet) objects,
|
||||
as well as the internal [`Svg`](/reference/api/svg) object.
|
||||
as well as the internal [`Svg`](/reference/api/svg) object.
|
||||
|
||||
All of these have an instantiated Attributes object in their `attributes` property.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: get()
|
||||
---
|
||||
***
|
||||
|
||||
## title: get()
|
||||
|
||||
```js
|
||||
string attributes.get(string key)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: getAsArray()
|
||||
---
|
||||
***
|
||||
|
||||
## title: getAsArray()
|
||||
|
||||
```js
|
||||
array attributes.getAsArray(string key)
|
||||
|
@ -18,4 +18,3 @@ paths.demo = new Path()
|
|||
let class = paths.demo.attributes.getAsArray('class');
|
||||
// class now holds: ["classA", "classB"]
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: remove()
|
||||
---
|
||||
***
|
||||
|
||||
## title: remove()
|
||||
|
||||
```js
|
||||
Attributes attributes.remove(string key)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: set()
|
||||
---
|
||||
***
|
||||
|
||||
## title: set()
|
||||
|
||||
```js
|
||||
Attributes attributes.set(string key, string value)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
title: Design
|
||||
***
|
||||
|
||||
title: Design
|
||||
order: 10
|
||||
---
|
||||
---------
|
||||
|
||||
The `Design` object in FreeSewing's core library serves a single purpose:
|
||||
To instantiate new pattern designs.
|
||||
|
@ -16,13 +17,13 @@ function freesewing.Design(
|
|||
)
|
||||
```
|
||||
|
||||
This constructor creates a new pattern 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"
|
||||
|
@ -35,9 +36,9 @@ const Sorcha = new freesewing.Design(config, plugins)
|
|||
|
||||
<Tip>
|
||||
|
||||
This method is a *super-constructor*. It will return a constructor
|
||||
This method is a *super-constructor*. It will return a constructor
|
||||
method that will become the default export of your design and
|
||||
should be called to instantiate your pattern.
|
||||
should be called to instantiate your pattern.
|
||||
|
||||
See [creating a new pattern design](/howtos/code/create-new-design) for a complete example.
|
||||
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Core API
|
||||
for: developers
|
||||
icons:
|
||||
- javascript
|
||||
- terms
|
||||
about: FreeSewing's core API reference documents all available methods and objects
|
||||
---
|
||||
icons:
|
||||
|
||||
* javascript
|
||||
* terms
|
||||
about: FreeSewing's core API reference documents all available methods and objects
|
||||
|
||||
***
|
||||
|
||||
This is the documentation for FreeSewing's core library, published as `@freesewing/core` on NPM.
|
||||
It's a complete toolbox for parametric design with a primary focus on
|
||||
It's a complete toolbox for parametric design with a primary focus on
|
||||
sewing patterns, but can be utilized for a variety of similar 2D design tasks.
|
||||
|
||||
## Getting started
|
||||
|
@ -21,7 +24,7 @@ import freesewing from '@freesewing/core'
|
|||
|
||||
<Tip>
|
||||
|
||||
This is the reference documentation. For a more hands-on walkthrough,
|
||||
This is the reference documentation. For a more hands-on walkthrough,
|
||||
please refer to our [pattern design tutorial](/tutorials/pattern-design/)
|
||||
|
||||
</Tip>
|
||||
|
@ -30,19 +33,18 @@ 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>
|
||||
|
||||
You will typically use the `Design()` constructor.
|
||||
The other constructors and utilities below are exported to facilitate unit testing.
|
||||
You will typically use the `Design()` constructor.\
|
||||
The other constructors and utilities below are exported to facilitate unit testing.
|
||||
|
||||
</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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Part
|
||||
order: 20
|
||||
---
|
||||
---------
|
||||
|
||||
The `Part` object in FreeSewing's core library holds all data and logic of a pattern part.
|
||||
The `Part` object in FreeSewing's core library holds all data and logic of a pattern part.
|
||||
A pattern part is what holds the actual information about points and paths,
|
||||
and multiple parts together typically make up a pattern.
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: Part.getId()
|
||||
---
|
||||
***
|
||||
|
||||
A part's `getId()` method will return an integer the can be used as an
|
||||
## title: Part.getId()
|
||||
|
||||
A part's `getId()` method will return an integer the can be used as an
|
||||
ID Points/Paths/Snippets. This method will ensure the ID is unique be
|
||||
keeping an internal record of the ID that have been used.
|
||||
keeping an internal record of the ID that have been used.
|
||||
It is typically used when programatically adding points, paths, or snippets.
|
||||
|
||||
## Part.getId() signature
|
||||
|
@ -30,5 +30,3 @@ export default function (part) {
|
|||
return part
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Part.raise.debug()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part.raise.debug()
|
||||
|
||||
A part's `raise.debug()` method will log a debug-level event.
|
||||
Debug events are typically used to pass information to pattern developers
|
||||
|
@ -35,4 +35,3 @@ export default function (part) {
|
|||
return part
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Part raise methods
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part raise methods
|
||||
|
||||
A part's different `raise` methods are used to bring information to the attention
|
||||
of the user, or developer. You can think of them as logging methods the register
|
||||
|
@ -15,7 +15,7 @@ roadmap](https://github.com/freesewing/freesewing/discussions/1278) for details.
|
|||
|
||||
</Warning>
|
||||
|
||||
There are four different types of information with their own method:
|
||||
There are four different types of information with their own method:
|
||||
|
||||
<ReadMore list />
|
||||
|
||||
|
@ -32,13 +32,13 @@ events: {
|
|||
|
||||
Calling the relevant `raise` method will add the data you pass to it to the relevant array.
|
||||
|
||||
For example, if we use:
|
||||
For example, if we use:
|
||||
|
||||
```js
|
||||
raise.info('Hello')
|
||||
```
|
||||
|
||||
The result will be:
|
||||
The result will be:
|
||||
|
||||
```js
|
||||
events: {
|
||||
|
@ -62,4 +62,3 @@ But if an error is raised, core won't attempt to pack the pattern parts on the p
|
|||
In other words, it will abort after the draft, and not provide a layout.
|
||||
|
||||
</Note>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Part.raise.error()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part.raise.error()
|
||||
|
||||
A part's `raise.error()` method will log a error-level event.
|
||||
Unlike other raised events which have no side-effects, if there is one or more
|
||||
|
@ -32,4 +32,3 @@ export default function (part) {
|
|||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Part.raise.info()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part.raise.info()
|
||||
|
||||
A part's `raise.info()` method will log a ingo-level event.
|
||||
Info events are typically used to pass information to users
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Part.raise.warning()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part.raise.warning()
|
||||
|
||||
A part's `raise.warning()` method will log a warning-level event.
|
||||
Warning events are typically used to pass information to pattern developers
|
||||
|
@ -41,4 +41,3 @@ export default function (part) {
|
|||
return part
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: Part.shorthand()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part.shorthand()
|
||||
|
||||
A part's `shorthand()` method provides easy access to a number of
|
||||
internal objects and properties. It does so be returning an object
|
||||
that contains all you need to draft your pattern parts. It is
|
||||
that contains all you need to draft your pattern parts. It is
|
||||
typically combined with object destructuring to pull out those
|
||||
properties you need.
|
||||
|
||||
|
@ -79,8 +79,7 @@ paths.example = new Path()
|
|||
|
||||
<Tip>
|
||||
|
||||
As you can see in the example above, you can/should load only
|
||||
As you can see in the example above, you can/should load only
|
||||
the shorthand you need by using object destructuring.
|
||||
|
||||
</Tip>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: Part.units()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Part.units()
|
||||
|
||||
A part's `units()` method will formats a float you pass it, which should
|
||||
represent a value in mm, into the units requested by the user.
|
||||
The returned value is to be used in presentation only, as it will be
|
||||
The returned value is to be used in presentation only, as it will be
|
||||
a string that includes the user's units.
|
||||
|
||||
<Tip>
|
||||
|
@ -34,4 +34,3 @@ export default function (part) {
|
|||
raise.info(`Pattern drafted for a ${units(measurements.chest)} chest`)
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "_curve()"
|
||||
---
|
||||
***
|
||||
|
||||
## title: "\_curve()"
|
||||
|
||||
```js
|
||||
Path path._curve(Point cp2, Point to)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: attr()
|
||||
---
|
||||
***
|
||||
|
||||
## title: attr()
|
||||
|
||||
```js
|
||||
Path path.attr(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: clone()
|
||||
---
|
||||
***
|
||||
|
||||
## title: clone()
|
||||
|
||||
```js
|
||||
Path path.clone()
|
||||
|
@ -30,4 +29,3 @@ paths.clone = paths.example
|
|||
.attr("class", "note lashed stroke-l")
|
||||
.attr("style", "stroke-opacity: 0.5");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: close()
|
||||
---
|
||||
***
|
||||
|
||||
## title: close()
|
||||
|
||||
```js
|
||||
Path path.close()
|
||||
|
@ -25,4 +25,3 @@ paths.line = new Path()
|
|||
.attr("data-text", "Path._close()")
|
||||
.attr("data-text-class", "text-sm right fill-note");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: curve()
|
||||
---
|
||||
***
|
||||
|
||||
## title: curve()
|
||||
|
||||
```js
|
||||
Path path.curve(Point cp1, Point cp2, Point to)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "curve_()"
|
||||
---
|
||||
***
|
||||
|
||||
## title: "curve\_()"
|
||||
|
||||
```js
|
||||
Path path.curve_(Point cp1, Point to)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: divide()
|
||||
---
|
||||
***
|
||||
|
||||
## title: divide()
|
||||
|
||||
```js
|
||||
array path.divide()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: edge()
|
||||
---
|
||||
***
|
||||
|
||||
## title: edge()
|
||||
|
||||
```js
|
||||
Point path.edge(string side)
|
||||
|
@ -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" caption="Example of the Path.edge() method" />
|
||||
|
||||
|
@ -48,4 +48,3 @@ for (let i of [
|
|||
"right"
|
||||
]) snippets[i] = new Snippet("notch", paths.demo.edge(i));
|
||||
```
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Path
|
||||
order: 30
|
||||
---
|
||||
---------
|
||||
|
||||
A path represents an SVG path; The lines and curves on our pattern.
|
||||
A path represents an SVG path; The lines and curves on our pattern.
|
||||
|
||||
The Path constructor takes no arguments:
|
||||
|
||||
|
@ -13,8 +14,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:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: end()
|
||||
---
|
||||
***
|
||||
|
||||
## title: end()
|
||||
|
||||
```js
|
||||
Point path.end()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: insop()
|
||||
---
|
||||
***
|
||||
|
||||
## title: insop()
|
||||
|
||||
```js
|
||||
Path path.insop(string id, Path path)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
---
|
||||
title: intersects()
|
||||
---
|
||||
***
|
||||
|
||||
```
|
||||
array|false path.intersects(Path path)
|
||||
```
|
||||
## title: intersects()
|
||||
|
||||
array|false path.intersects(Path path)
|
||||
|
||||
Returns the Point object(s) where the path intersects with a path you pass it.
|
||||
|
||||
|
@ -55,4 +53,3 @@ for (let p of paths.demo1.intersects(paths.demo2)) {
|
|||
snippets[part.getId()] = new Snippet("notch", p);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: intersectsX()
|
||||
---
|
||||
***
|
||||
|
||||
## title: intersectsX()
|
||||
|
||||
```js
|
||||
array|false path.intersectsX(float x)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: intersectsY()
|
||||
---
|
||||
***
|
||||
|
||||
## title: intersectsY()
|
||||
|
||||
```js
|
||||
array|false path.intersectsY(float y)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: join()
|
||||
---
|
||||
***
|
||||
|
||||
## title: join()
|
||||
|
||||
```js
|
||||
Path path.join(path other)
|
||||
|
@ -40,4 +40,3 @@ paths.joint = paths.path1
|
|||
.attr("class", "note lashed stroke-l")
|
||||
.attr("style", "stoke-opacity: 0.5");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: length()
|
||||
---
|
||||
***
|
||||
|
||||
## title: length()
|
||||
|
||||
```js
|
||||
float path.length()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: line()
|
||||
---
|
||||
***
|
||||
|
||||
## title: line()
|
||||
|
||||
```js
|
||||
Path path.line(Point to)
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
---
|
||||
title: move()
|
||||
---
|
||||
***
|
||||
|
||||
## title: move()
|
||||
|
||||
```js
|
||||
Path path.move(Point to)
|
||||
```
|
||||
|
||||
Moves to a given point without drawing a line.
|
||||
|
||||
Moves to a given point without drawing a line.
|
||||
|
||||
<Tip>
|
||||
|
||||
###### Always start your path with a move
|
||||
|
||||
When drawing a path, you must always start with a `move()` call,
|
||||
When drawing a path, you must always start with a `move()` call,
|
||||
followed by your `line()` and/or `curve()` calls
|
||||
and an optional `close()` call.
|
||||
|
||||
These calls are chainable, making your code easier to read:
|
||||
|
||||
|
||||
```js
|
||||
paths.example = new Path()
|
||||
.move(points.a)
|
||||
|
@ -29,7 +28,6 @@ paths.example = new Path()
|
|||
|
||||
</Tip>
|
||||
|
||||
|
||||
<Example part="path_move" caption="Example of the Path.move() method" />
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
title: noop()
|
||||
---
|
||||
|
||||
***
|
||||
|
||||
## title: noop()
|
||||
|
||||
```js
|
||||
Path path.noop(string id)
|
||||
```
|
||||
|
||||
Adds a placeholder path opertion.
|
||||
Adds a placeholder path opertion.\
|
||||
A `noop` operation does nothing, but is intended to be replaced later with [`Path.insop()`](#insop).
|
||||
|
||||
<Fixme>Add example</Fixme>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: offset()
|
||||
---
|
||||
|
||||
***
|
||||
|
||||
## title: offset()
|
||||
|
||||
```js
|
||||
Path path.offset(float distance)
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: reverse()
|
||||
---
|
||||
***
|
||||
|
||||
## title: reverse()
|
||||
|
||||
```js
|
||||
Path path.reverse()
|
||||
|
@ -10,7 +10,7 @@ Returns a path that is the reversed version of this path. As in, start becomes e
|
|||
|
||||
<Note>
|
||||
|
||||
The reversed path is a shallow copy.
|
||||
The reversed path is a shallow copy.
|
||||
It will in other words not inherit the attributes of the original path.
|
||||
|
||||
If you want a deep copy, including the attributes, use `Path.clone().reverse()`.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: setRender()
|
||||
---
|
||||
***
|
||||
|
||||
## title: setRender()
|
||||
|
||||
```js
|
||||
Path path.setRender(bool render)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: shiftAlong()
|
||||
---
|
||||
***
|
||||
|
||||
## title: shiftAlong()
|
||||
|
||||
```js
|
||||
Point path.shiftAlong(float distance[, int stepsPerMm=25])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: shiftFractionAlong()
|
||||
---
|
||||
***
|
||||
|
||||
## title: shiftFractionAlong()
|
||||
|
||||
```js
|
||||
Point path.shiftFractionAlong(float fraction[, int stepsPerMm=25])
|
||||
|
@ -9,8 +9,8 @@ Point path.shiftFractionAlong(float fraction[, int stepsPerMm=25])
|
|||
Returns a point that lies at fraction of the length of the path travelled along the path.
|
||||
|
||||
<Example
|
||||
part="path_shiftfractionalong"
|
||||
caption="Example of the Path.shiftFractionAlong() method"
|
||||
part="path_shiftfractionalong"
|
||||
caption="Example of the Path.shiftFractionAlong() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -53,4 +53,3 @@ If you don't need that precision, you can pass a lower number.
|
|||
But for most cases, you can just ignore it.
|
||||
|
||||
</Note>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: split
|
||||
---
|
||||
|
||||
***
|
||||
|
||||
## title: split
|
||||
|
||||
```js
|
||||
array path.split(Point splitPoint)
|
||||
```
|
||||
|
@ -9,8 +9,8 @@ array path.split(Point splitPoint)
|
|||
Splits a path in two halves, on a point along that path that you pass it.
|
||||
|
||||
<Example
|
||||
part="path_split"
|
||||
caption="Example of the Path.split() method"
|
||||
part="path_split"
|
||||
caption="Example of the Path.split() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: start()
|
||||
---
|
||||
***
|
||||
|
||||
## title: start()
|
||||
|
||||
```js
|
||||
Point path.start()
|
||||
|
@ -9,8 +9,8 @@ Point path.start()
|
|||
Returns the Point object at the start of the path.
|
||||
|
||||
<Example
|
||||
part="path_start"
|
||||
caption="Example of the Path.start() method"
|
||||
part="path_start"
|
||||
caption="Example of the Path.start() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
title: translate()
|
||||
---
|
||||
|
||||
***
|
||||
|
||||
## title: translate()
|
||||
|
||||
```js
|
||||
Path path.translate(float deltaX, float deltaY)
|
||||
```
|
||||
|
||||
Returns a path with
|
||||
Returns a path with
|
||||
[a translate transform](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform#Translate)
|
||||
applied.
|
||||
|
||||
<Example
|
||||
part="path_translate"
|
||||
caption="Example of the Path.translate() method"
|
||||
part="path_translate"
|
||||
caption="Example of the Path.translate() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: trim()
|
||||
---
|
||||
***
|
||||
|
||||
## title: trim()
|
||||
|
||||
```js
|
||||
Path path.trim()
|
||||
|
@ -19,18 +19,18 @@ 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
|
||||
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).
|
||||
|
||||
</Warning>
|
||||
|
||||
<Example
|
||||
part="path_trim"
|
||||
caption="Example of the Path.trim() method"
|
||||
part="path_trim"
|
||||
caption="Example of the Path.trim() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.draft()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.draft()
|
||||
|
||||
A pattern's `draft()` method will draft all the different pattern parts
|
||||
making sure to do so in the right order, handle dependencies, resolve
|
||||
|
@ -13,7 +13,7 @@ that are required for the pattern to be drafted.
|
|||
|
||||
```js
|
||||
Pattern pattern.draft()
|
||||
```
|
||||
```
|
||||
|
||||
## Pattern.draft() example
|
||||
|
||||
|
@ -29,5 +29,4 @@ const pattern = new Aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.draft().render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Pattern
|
||||
order: 15
|
||||
---
|
||||
---------
|
||||
|
||||
The `Pattern` object in FreeSewing's core library holds all data and logic of a pattern.
|
||||
The `Pattern` object in FreeSewing's core library holds all data and logic of a pattern.
|
||||
It is the parametric blueprint that when instantiated with a user's measurements and
|
||||
objects will generated a made-to-measure pattern.
|
||||
|
||||
|
@ -18,7 +19,6 @@ A pattern is instantiated by passing a [settings object](/reference/settings/) t
|
|||
This settings objects holds, amongst other things, the measurements and options chosen by the user.
|
||||
Refer to the [settings documentation](/reference/settings/) for an exhaustive list.
|
||||
|
||||
|
||||
## Pattern properties
|
||||
|
||||
| Property | Description |
|
||||
|
@ -32,15 +32,15 @@ Refer to the [settings documentation](/reference/settings/) for an exhaustive li
|
|||
| `store` | A [Store](/en/docs/developer/api/store) instance |
|
||||
| `svg` | An [Svg](/en/docs/developer/api/svg) instance |
|
||||
|
||||
- `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](/en/docs/developer/api/part) constructor
|
||||
- `store` : A [Store](/en/docs/developer/api/store) instance
|
||||
- `svg` : An [Svg](/en/docs/developer/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](/en/docs/developer/api/part) constructor
|
||||
* `store` : A [Store](/en/docs/developer/api/store) instance
|
||||
* `svg` : An [Svg](/en/docs/developer/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
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: Pattern.getRenderProps()
|
||||
---
|
||||
***
|
||||
|
||||
A pattern's `getRenderProps()` method will return a set of properties
|
||||
## title: Pattern.getRenderProps()
|
||||
|
||||
A pattern's `getRenderProps()` method will return a set of properties
|
||||
that allow the pattern to be rendered be an external renderer such as
|
||||
a React component. It should only be called after calling `Pattern.draft()`.
|
||||
|
||||
|
@ -10,7 +10,7 @@ a React component. It should only be called after calling `Pattern.draft()`.
|
|||
|
||||
```js
|
||||
Object pattern.getRenderProps()
|
||||
```
|
||||
```
|
||||
|
||||
The object returned by this method contains the following properties:
|
||||
|
||||
|
@ -29,7 +29,6 @@ See [the Draft React component](/reference/packages/components/draft/) for more
|
|||
|
||||
</Tip>
|
||||
|
||||
|
||||
## Pattern.getRenderProps() example
|
||||
|
||||
```jsx
|
||||
|
@ -44,5 +43,4 @@ const MyReactComponent = ({ measurements }) => {
|
|||
}
|
||||
|
||||
export default MyReactComponent
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: Pattern.on()
|
||||
---
|
||||
***
|
||||
|
||||
A pattern's `on()` method allows you to attach a function to one of the
|
||||
## title: Pattern.on()
|
||||
|
||||
A pattern's `on()` method allows you to attach a function to one of the
|
||||
pattern's [lifecycle hooks](/reference/hooks/). It takes the
|
||||
lifecycle hook's name as the first argument and the function as the second.
|
||||
This method will then be triggered by the lifecycle hook.
|
||||
|
@ -13,7 +13,7 @@ This method will then be triggered by the lifecycle hook.
|
|||
|
||||
```js
|
||||
Pattern pattern.on(string hook, function method)
|
||||
```
|
||||
```
|
||||
|
||||
<Tip>
|
||||
|
||||
|
@ -38,4 +38,3 @@ Your pattern now has a yellow background.
|
|||
The [plugin guide](/guides/plugins/) contains more info on how you can use hooks
|
||||
|
||||
</Tip>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.render()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.render()
|
||||
|
||||
A pattern's `render()` method will render the pattern to SVG and return
|
||||
the SVG as a string. It should only ever be called after calling
|
||||
|
@ -10,7 +10,7 @@ the SVG as a string. It should only ever be called after calling
|
|||
|
||||
```js
|
||||
string pattern.render()
|
||||
```
|
||||
```
|
||||
|
||||
# Pattern.render() example
|
||||
|
||||
|
@ -26,5 +26,4 @@ const pattern = new Aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.draft().render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
---
|
||||
title: Pattern.sample()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sample()
|
||||
|
||||
A pattern's `sample()` method will *sample* the pattern which means
|
||||
to draft it in different iterations while adjusting the input settings.
|
||||
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.sampleMeasurement()](/reference/apu/pattern/sampleoption), or
|
||||
[Pattern.sampleModels()](/reference/apu/pattern/sampleoption) to sample
|
||||
an option, a measurement, or a set of measurements respectively.
|
||||
|
||||
Unlike those three methods where you pass the relevant info to to the method,
|
||||
this `Pattern.sample()` will instead read the `pattern.settings.sample`
|
||||
Unlike those three methods where you pass the relevant info to to the method,
|
||||
this `Pattern.sample()` will instead read the `pattern.settings.sample`
|
||||
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
|
||||
|
@ -56,12 +56,11 @@ roadmap](https://github.com/freesewing/freesewing/discussions/1278) for details.
|
|||
|
||||
</Warning>
|
||||
|
||||
|
||||
## Pattern.sample() signature
|
||||
|
||||
```js
|
||||
Pattern pattern.sample()
|
||||
```
|
||||
```
|
||||
|
||||
## Pattern.sample() example
|
||||
|
||||
|
@ -77,5 +76,4 @@ const pattern = new Aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.sample().render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
title: Pattern.sampleMeasurement()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sampleMeasurement()
|
||||
|
||||
A pattern's `sampleMeasurement()` method will *sample* a given measurement,
|
||||
which means to draft it in different iterations while adjusting the input value
|
||||
of the given measurement.
|
||||
In practice, it will draft 10 iterations of the pattern
|
||||
In practice, it will draft 10 iterations of the pattern
|
||||
while adapting the measurement between 90% and 110% of its original value.
|
||||
|
||||
<Tip>
|
||||
|
@ -34,5 +34,4 @@ import models from "@freesewing/models"
|
|||
const pattern = new Aaron({ measurements: models.manSize38 })
|
||||
|
||||
const svg = pattern.sampleMeasurement("chest").render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.sampleModels()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sampleModels()
|
||||
|
||||
A pattern's `sampleModels()` method will *sample* a pattern for a list of
|
||||
models you pass to it. It will draft different iterations of the pattern,
|
||||
|
@ -27,7 +27,8 @@ In other words, for each sample, the anchor point will be kept in the same locat
|
|||
|
||||
```js
|
||||
Pattern pattern.sampleModels(object models, string focus)
|
||||
```
|
||||
```
|
||||
|
||||
The models object you pass as the first parameter should be structured as such:
|
||||
|
||||
```js
|
||||
|
@ -46,12 +47,12 @@ The models object you pass as the first parameter should be structured as such:
|
|||
}
|
||||
```
|
||||
|
||||
The (optional) string you can pass as the second parameter should hold the
|
||||
The (optional) string you can pass as the second parameter should hold the
|
||||
key of one of the models in the first parameter. In our example above, it
|
||||
could hold `modelName2` for example.
|
||||
|
||||
By passing this second parameter, you can put the *focus* on one of the models,
|
||||
which will influence the render style, and make it
|
||||
By passing this second parameter, you can put the *focus* on one of the models,
|
||||
which will influence the render style, and make it
|
||||
easier to see a comparison between a given set of measrurements, and the rest.
|
||||
|
||||
Alternatively, you can use the `Pattern.sample()` method and set `settings.sample.focus` to the key
|
||||
|
@ -66,5 +67,4 @@ import models from "@freesewing/models"
|
|||
const Aaron = new Aaron()
|
||||
|
||||
const svg = aaron.sampleModels(models, "manSize38").render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Pattern.sampleOption()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sampleOption()
|
||||
|
||||
A pattern's `sampleOption()` method will *sample* a given option,
|
||||
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
|
||||
|
@ -33,12 +33,10 @@ In other words, for each sample, the anchor point will be kept in the same locat
|
|||
|
||||
```js
|
||||
Pattern pattern.sampleOption(string option)
|
||||
```
|
||||
```
|
||||
|
||||
## Pattern.sampleOption() example
|
||||
|
||||
|
||||
|
||||
```js
|
||||
import Aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
@ -48,5 +46,4 @@ const pattern = new aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.sampleOption("necklineDrop").render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.use()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.use()
|
||||
|
||||
A pattern's `use()` method will load a FreeSewing plugin.
|
||||
Plugins are a way to extend a pattern's functionality, and can be
|
||||
|
@ -13,7 +13,7 @@ to run-time plugins. For more details, refer to [the plugin guide](/guides/plugi
|
|||
|
||||
```js
|
||||
Pattern pattern.use(object plugin)
|
||||
```
|
||||
```
|
||||
|
||||
See [the plugin guide](/guides/plugins/) for details on how to structure
|
||||
you plugin object.
|
||||
|
@ -33,4 +33,4 @@ const pattern = new Aaron({
|
|||
}).use(theme)
|
||||
|
||||
const svg = pattern.draft().render()
|
||||
```
|
||||
```
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
title: angle()
|
||||
---
|
||||
***
|
||||
|
||||
## title: angle()
|
||||
|
||||
```js
|
||||
float point.angle(Point point)
|
||||
```
|
||||
```
|
||||
|
||||
Returns the angle made by a line from this point to the point you pass it.
|
||||
|
||||
<Example
|
||||
part="point_angle"
|
||||
caption="An example of the Point.angle() method"
|
||||
part="point_angle"
|
||||
caption="An example of the Point.angle() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -28,4 +28,3 @@ paths.line = new Path()
|
|||
.line(points.moon)
|
||||
.attr("class", "dashed");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: attr()
|
||||
---
|
||||
***
|
||||
|
||||
## title: attr()
|
||||
|
||||
```js
|
||||
Point point.attr(
|
||||
|
@ -16,8 +16,8 @@ This allows you to chain different calls together as in the example below.
|
|||
If the third parameter is set to `true` it will call `this.attributes.set()` instead, thereby overwriting the value of the attribute.
|
||||
|
||||
<Example
|
||||
part="point_attr"
|
||||
caption="An example of the Point.attr() method"
|
||||
part="point_attr"
|
||||
caption="An example of the Point.attr() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -27,4 +27,3 @@ points.anchor = new Point(100, 25)
|
|||
.attr("data-text", "freesewingIsMadeByJoostDeCockAndContributors")
|
||||
.attr("data-text-class", "center");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
---
|
||||
title: clone()
|
||||
---
|
||||
***
|
||||
|
||||
```
|
||||
Point point.clone()
|
||||
```
|
||||
## title: clone()
|
||||
|
||||
Point point.clone()
|
||||
|
||||
Returns a new point with the same coordinates and attributes as this point.
|
||||
|
||||
|
@ -18,8 +16,8 @@ The `Point.copy()` method will only copy the point's coordinates, whereas this
|
|||
</Note>
|
||||
|
||||
<Example
|
||||
part="point_clone"
|
||||
caption="An example of the Point.clone() method"
|
||||
part="point_clone"
|
||||
caption="An example of the Point.clone() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -33,4 +31,3 @@ The `Point.copy()` method will only copy the point's coordinates, whereas this
|
|||
|
||||
snippets.x = new Snippet("notch", points.A);
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: copy()
|
||||
---
|
||||
***
|
||||
|
||||
## title: copy()
|
||||
|
||||
```js
|
||||
Point point.copy()
|
||||
|
@ -9,8 +9,8 @@ Point point.copy()
|
|||
Returns a new point with the same coordinates as this point.
|
||||
|
||||
<Example
|
||||
part="point_copy"
|
||||
caption="An example of the Point.copy() method"
|
||||
part="point_copy"
|
||||
caption="An example of the Point.copy() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -23,4 +23,3 @@ points.B = points.A.copy().attr("data-text", "Point B");
|
|||
|
||||
snippets.x = new Snippet("notch", points.A);
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: dx()
|
||||
---
|
||||
***
|
||||
|
||||
## title: dx()
|
||||
|
||||
```js
|
||||
float point.dx(Point point)
|
||||
|
@ -9,8 +9,8 @@ float point.dx(Point point)
|
|||
Returns the delta along the X-axis between this point and the point you pass it.
|
||||
|
||||
<Example
|
||||
part="point_dx"
|
||||
caption="An example of the Point.dx() method"
|
||||
part="point_dx"
|
||||
caption="An example of the Point.dx() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -42,4 +42,3 @@ paths.line_dy = new Path()
|
|||
.line(points.totop)
|
||||
.attr("class", "dashed")
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: dy()
|
||||
---
|
||||
***
|
||||
|
||||
## title: dy()
|
||||
|
||||
```js
|
||||
float point.dy(Point point)
|
||||
|
@ -9,8 +9,8 @@ float point.dy(Point point)
|
|||
Returns the delta along the Y-axis between this point and the point you pass it.
|
||||
|
||||
<Example
|
||||
part="point_dy"
|
||||
caption="An example of the Point.dy() method"
|
||||
part="point_dy"
|
||||
caption="An example of the Point.dy() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Point
|
||||
order: 25
|
||||
---
|
||||
---------
|
||||
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: flipX()
|
||||
---
|
||||
***
|
||||
|
||||
## title: flipX()
|
||||
|
||||
```js
|
||||
Point point.flipX(Point mirror = false)
|
||||
|
@ -11,8 +11,8 @@ Returns a new point that mirrors this point around the X-value of the point your
|
|||
If you don't pass it a point, it will mirror around an X-value of zero.
|
||||
|
||||
<Example
|
||||
part="point_flipx"
|
||||
caption="An example of the Point.flipX() method"
|
||||
part="point_flipx"
|
||||
caption="An example of the Point.flipX() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -61,4 +61,3 @@ paths.mirror = new Path()
|
|||
.line(points.bottom)
|
||||
.attr("class", "note dashed");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: flipY()
|
||||
---
|
||||
***
|
||||
|
||||
## title: flipY()
|
||||
|
||||
```js
|
||||
Point point.flipY(Point mirror = false)
|
||||
|
@ -13,8 +13,8 @@ If you don't pass it a point, it will mirror around a Y-value of zero.
|
|||
### Point.flipY() example
|
||||
|
||||
<Example
|
||||
part="point_flipy"
|
||||
caption="An example of the Point.flipY() method"
|
||||
part="point_flipy"
|
||||
caption="An example of the Point.flipY() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
@ -68,4 +68,3 @@ paths.skylineTop = new Path()
|
|||
.line(points.houseWallRight)
|
||||
.line(points.end);
|
||||
```
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
title: rotate()
|
||||
---
|
||||
***
|
||||
|
||||
## title: rotate()
|
||||
|
||||
```js
|
||||
Point point.rotate(float angle, Point center)
|
||||
```
|
||||
```
|
||||
|
||||
Rotates a point the number of degrees you pass it around the point you pass it.
|
||||
|
||||
<Example
|
||||
part="point_rotate"
|
||||
caption="An example of the Point.rotate() method"
|
||||
part="point_rotate"
|
||||
caption="An example of the Point.rotate() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: shift()
|
||||
---
|
||||
***
|
||||
|
||||
## title: shift()
|
||||
|
||||
```js
|
||||
Point point.shift(float degrees, float distance)
|
||||
|
@ -9,8 +9,8 @@ Point point.shift(float degrees, float distance)
|
|||
Returns a point that lies distance in the direction of degrees from this point.
|
||||
|
||||
<Example
|
||||
part="point_shift"
|
||||
caption="An example of the Point.shift() method"
|
||||
part="point_shift"
|
||||
caption="An example of the Point.shift() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: shiftFractionTowards()
|
||||
---
|
||||
***
|
||||
|
||||
## title: shiftFractionTowards()
|
||||
|
||||
```js
|
||||
Point point.shiftFractionTowards(Point target, float fraction)
|
||||
|
@ -9,8 +9,8 @@ Point point.shiftFractionTowards(Point target, float fraction)
|
|||
Returns a point that is shifted towards the target by a fraction of the distance between this point and the target.
|
||||
|
||||
<Example
|
||||
part="point_shiftfractiontowards"
|
||||
caption="An example of the Point.shiftFractionTowards() method"
|
||||
part="point_shiftfractiontowards"
|
||||
caption="An example of the Point.shiftFractionTowards() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: shiftOutwards()
|
||||
---
|
||||
***
|
||||
|
||||
## title: shiftOutwards()
|
||||
|
||||
```js
|
||||
Point point.shiftOutwards(Point direction, float distance)
|
||||
|
@ -9,8 +9,8 @@ Point point.shiftOutwards(Point direction, float distance)
|
|||
Returns a point that is shifted distance beyond target in the direction of target.
|
||||
|
||||
<Example
|
||||
part="point_shiftoutwards"
|
||||
caption="An example of the Point.shiftOutwards() method"
|
||||
part="point_shiftoutwards"
|
||||
caption="An example of the Point.shiftOutwards() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: shiftTowards()
|
||||
---
|
||||
***
|
||||
|
||||
## title: shiftTowards()
|
||||
|
||||
```js
|
||||
Point point.shiftTowards(Point target, float distance)
|
||||
|
@ -9,8 +9,8 @@ Point point.shiftTowards(Point target, float distance)
|
|||
Returns a point that lies distance in the direction of target.
|
||||
|
||||
<Example
|
||||
part="point_shifttowards"
|
||||
caption="An example of the Point.shiftTowards() method"
|
||||
part="point_shifttowards"
|
||||
caption="An example of the Point.shiftTowards() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: sitsOn()
|
||||
---
|
||||
***
|
||||
|
||||
## title: sitsOn()
|
||||
|
||||
```js
|
||||
bool point.sitsOn(Point check)
|
||||
|
@ -9,8 +9,8 @@ bool point.sitsOn(Point check)
|
|||
Returns true if the point has the same coordinates as the one you pass to it.
|
||||
|
||||
<Example
|
||||
part="point_sitson"
|
||||
caption="An example of the Point.sitsOn() method"
|
||||
part="point_sitson"
|
||||
caption="An example of the Point.sitsOn() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: sitsRoughlyOn()
|
||||
---
|
||||
***
|
||||
|
||||
## title: sitsRoughlyOn()
|
||||
|
||||
```js
|
||||
bool point.sitsRoughlyOn(Point check)
|
||||
|
@ -12,14 +12,14 @@ Returns true is the point has roughly the same coordinates as the one you pass t
|
|||
|
||||
###### How rough?
|
||||
|
||||
The difference between this method and [Point.sitsOn](/reference/api/point/sitson/) is
|
||||
The difference between this method and [Point.sitsOn](/reference/api/point/sitson/) is
|
||||
that this one rounds things down to the nearest integer (thus mm) before checking.
|
||||
|
||||
</Note>
|
||||
|
||||
<Example
|
||||
part="point_sitsroughlyon"
|
||||
caption="An example of the Point.sitsRoughlyOn() method"
|
||||
part="point_sitsroughlyon"
|
||||
caption="An example of the Point.sitsRoughlyOn() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
---
|
||||
title: translate()
|
||||
---
|
||||
|
||||
***
|
||||
|
||||
## title: translate()
|
||||
|
||||
```js
|
||||
Point point.translate(float deltaX, float deltaY)
|
||||
```
|
||||
|
||||
Returns a point with
|
||||
[a translate transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate)
|
||||
applied.
|
||||
Returns a point with
|
||||
[a translate transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate)
|
||||
applied.
|
||||
|
||||
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
|
||||
|
||||
<Example
|
||||
part="point_translate"
|
||||
caption="An example of the Point.translate() method"
|
||||
part="point_translate"
|
||||
caption="An example of the Point.translate() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: attr()
|
||||
---
|
||||
***
|
||||
|
||||
## title: attr()
|
||||
|
||||
```js
|
||||
Snippet snippet.attr(
|
||||
|
@ -10,15 +10,15 @@ Snippet snippet.attr(
|
|||
)
|
||||
```
|
||||
|
||||
This `Snippet.attr()` method calls [`Attributes.add()`](./attributes#add) under the hood,
|
||||
This `Snippet.attr()` method calls [`Attributes.add()`](./attributes#add) under the hood,
|
||||
but returns the Snippet object. This allows you to chain different calls together.
|
||||
|
||||
If the third parameter is set to `true` it will call [`Attributes.set()`](./attributes#set) instead,
|
||||
If the third parameter is set to `true` it will call [`Attributes.set()`](./attributes#set) instead,
|
||||
thereby overwriting the value of the attribute.
|
||||
|
||||
<Example
|
||||
part="snippet_attr"
|
||||
caption="An example of the Snippet.attr() method"
|
||||
part="snippet_attr"
|
||||
caption="An example of the Snippet.attr() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: clone()
|
||||
---
|
||||
***
|
||||
|
||||
## title: clone()
|
||||
|
||||
```js
|
||||
Snippet snippet.clone()
|
||||
|
@ -9,8 +9,8 @@ Snippet snippet.clone()
|
|||
Returns a new Snippets object that is a deep copy of this one.
|
||||
|
||||
<Example
|
||||
part="snippet_clone"
|
||||
caption="An example of the Snippet.clone() method"
|
||||
part="snippet_clone"
|
||||
caption="An example of the Snippet.clone() method"
|
||||
/>
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Snippet
|
||||
order: 35
|
||||
---
|
||||
---------
|
||||
|
||||
A snippet is a reuseable bit of markup for your pattern. They are added to the
|
||||
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 +18,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:
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: "Store"
|
||||
components: true
|
||||
order: 70
|
||||
---
|
||||
---------
|
||||
|
||||
The **Store** object holds a simple key/value store with
|
||||
methods for storing and retrieving information.
|
||||
The **Store** object holds a simple key/value store with
|
||||
methods for storing and retrieving information.\
|
||||
A single store per pattern is shared by all pattern parts.
|
||||
|
||||
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.
|
||||
|
||||
The `Store` object exposes the following methods:
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
title: get()
|
||||
---
|
||||
***
|
||||
|
||||
## title: get()
|
||||
|
||||
```js
|
||||
mixed store.get(string key)
|
||||
```
|
||||
|
||||
Returnes the value stored under `key`.
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
title: set()
|
||||
---
|
||||
***
|
||||
|
||||
## title: set()
|
||||
|
||||
```js
|
||||
void store.set(string key, mixed value)
|
||||
```
|
||||
|
||||
Stores the value of `value` in the store under key `key`.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: setIfUnset
|
||||
---
|
||||
***
|
||||
|
||||
## title: setIfUnset
|
||||
|
||||
```js
|
||||
void store.setIfUnset(string key, mixed value)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
title: attributes
|
||||
---
|
||||
***
|
||||
|
||||
## title: attributes
|
||||
|
||||
An [Attributes](/reference/api/attributes) instance that controls the attributes of the SVG tag.
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
title: defs
|
||||
---
|
||||
***
|
||||
|
||||
A string that will be rendered
|
||||
as [the defs section](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) of
|
||||
## title: defs
|
||||
|
||||
A string that will be rendered
|
||||
as [the defs section](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) of
|
||||
the SVG document.
|
||||
|
||||
The defs attribute is where plugins will add additional snippets.
|
||||
|
@ -13,9 +13,11 @@ The defs attribute is where plugins will add additional snippets.
|
|||
/* svg.defs will be inserted */
|
||||
</defs>
|
||||
```
|
||||
|
||||
<Warning>
|
||||
|
||||
###### Add, but don't overwrite
|
||||
|
||||
When adding your own defs, it's important not to
|
||||
overwrite this property, but rather add your own.
|
||||
|
||||
|
@ -24,6 +26,7 @@ In other words, do this:
|
|||
```js
|
||||
svg.defs += myDefs;
|
||||
```
|
||||
|
||||
and don't do this:
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Svg
|
||||
components: true
|
||||
order: 80
|
||||
---
|
||||
---------
|
||||
|
||||
The `Svg` object in FreeSewing's core library represents an SVG document.
|
||||
It is not directly exposed, but it is available as the `svg` attribute
|
||||
|
@ -14,4 +15,3 @@ want to develop a plugin, or use a custom layout:
|
|||
## Svg properties
|
||||
|
||||
<ReadMore list />
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: head
|
||||
---
|
||||
***
|
||||
|
||||
## title: head
|
||||
|
||||
A string that combines the `style`, `script`,
|
||||
and `defs` sections and an opening tag for an SVG group.
|
||||
|
@ -26,10 +26,9 @@ and `defs` sections and an opening tag for an SVG group.
|
|||
|
||||
###### This does not include the opening SVG tag
|
||||
|
||||
Note that while [Pattern.svg.tail](/reference/api/pattern/svg/tail/) closes the SVG tag,
|
||||
[Pattern.svg.head](/reference/api/pattern/head/) does not open it.
|
||||
Note that while [Pattern.svg.tail](/reference/api/pattern/svg/tail/) closes the SVG tag,
|
||||
[Pattern.svg.head](/reference/api/pattern/head/) does not open it.
|
||||
That's because the `width`, `height` and `viewBox` attributes will
|
||||
depend on the main body of the SVG document.
|
||||
|
||||
</Note>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: layout
|
||||
---
|
||||
***
|
||||
|
||||
## title: layout
|
||||
|
||||
An object that holds rendered SVG for all parts, and a list of their transforms.
|
||||
It is structured as follows:
|
||||
|
@ -14,4 +14,3 @@ It is structured as follows:
|
|||
// Other parts follow
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: pattern
|
||||
---
|
||||
***
|
||||
|
||||
## title: pattern
|
||||
|
||||
A reference to [the Pattern object](/reference/api/pattern/).
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: prefix
|
||||
---
|
||||
***
|
||||
|
||||
## title: prefix
|
||||
|
||||
A string that will be rendered before the opening SVG tag.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: script
|
||||
---
|
||||
***
|
||||
|
||||
## title: script
|
||||
|
||||
A string that will be rendered as the script section of the SVG document.
|
||||
|
||||
|
@ -15,6 +15,7 @@ We don't use this ourselves, but it's there if you need it.
|
|||
<Warning>
|
||||
|
||||
###### Add, but don't overwrite
|
||||
|
||||
When adding your own script, it's important not to
|
||||
overwrite this property, but rather add your own.
|
||||
|
||||
|
@ -23,6 +24,7 @@ In other words, do this:
|
|||
```js
|
||||
svg.script += myScript;
|
||||
```
|
||||
|
||||
and don't do this:
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: style
|
||||
---
|
||||
***
|
||||
|
||||
## title: style
|
||||
|
||||
A string that will be rendered as the style section of the SVG document.
|
||||
|
||||
|
@ -15,6 +15,7 @@ The style attribute is where plugins will add additional snippets.
|
|||
<Warning>
|
||||
|
||||
###### Add, but don't overwrite
|
||||
|
||||
When adding your own styles, it's important not to
|
||||
overwrite this property, but rather add your own.
|
||||
|
||||
|
@ -23,6 +24,7 @@ In other words, do this:
|
|||
```js
|
||||
svg.style += myStyles;
|
||||
```
|
||||
|
||||
and don't do this:
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
---
|
||||
title: tail
|
||||
---
|
||||
***
|
||||
|
||||
A string that closes both the group opened by [Pattern.svg.head](/reference/api/pattern/svg/head/) and the SVG tag.
|
||||
## title: tail
|
||||
|
||||
A string that closes both the group opened by [Pattern.svg.head](/reference/api/pattern/svg/head/) and the SVG tag.
|
||||
|
||||
```svg
|
||||
</g>
|
||||
<!-- end of group #fs-container -->
|
||||
</svg>
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: beamIntersectsCircle()
|
||||
---
|
||||
***
|
||||
|
||||
## title: beamIntersectsCircle()
|
||||
|
||||
```js
|
||||
array | false utils.beamIntersectsCircle(
|
||||
|
@ -16,13 +16,13 @@ Finds the intersection between an endless line through points `point1` and `poin
|
|||
and a circle with its center at point `center` and a radius of `radius` mm.
|
||||
|
||||
The 5th and last parameter controls the *sorting* of the found intersections.
|
||||
This will (almost) always return 2 intersections, and you can choose how
|
||||
This will (almost) always return 2 intersections, and you can choose how
|
||||
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" caption="A Utils.beamIntersectsCircle() example" />
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: beamIntersectsX()
|
||||
---
|
||||
***
|
||||
|
||||
## title: beamIntersectsX()
|
||||
|
||||
```js
|
||||
Point | false utils.beamIntersectsX(Point A, Point B, float X)
|
||||
|
@ -34,4 +34,3 @@ for the intersection, or `false` there is no intersection.
|
|||
.line(new Point(40, 35))
|
||||
.attr("class", "note dashed");
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: beamIntersectsY()
|
||||
---
|
||||
***
|
||||
|
||||
## title: beamIntersectsY()
|
||||
|
||||
```js
|
||||
Point | false utils.beamIntersectsY(Point A, Point B, float Y)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: beamsIntersect()
|
||||
---
|
||||
***
|
||||
|
||||
## title: beamsIntersect()
|
||||
|
||||
```js
|
||||
Point | false utils.beamsIntersect(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: circlesIntersect()
|
||||
---
|
||||
***
|
||||
|
||||
## title: circlesIntersect()
|
||||
|
||||
```js
|
||||
array | false utils.circlesIntersect(
|
||||
|
@ -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" caption="A Utils.circlesIntersect() example" />
|
||||
|
||||
|
@ -59,4 +59,3 @@ snippets.second1 = new Snippet("notch", intersections1[1]);
|
|||
snippets.first2 = new Snippet("bnotch", intersections2[0]);
|
||||
snippets.second2 = new Snippet("notch", intersections2[1]);
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: curveIntersectsX()
|
||||
---
|
||||
***
|
||||
|
||||
## title: curveIntersectsX()
|
||||
|
||||
```js
|
||||
array | Point | false utils.curveIntersectsX(
|
||||
|
@ -13,15 +13,15 @@ array | Point | false utils.curveIntersectsX(
|
|||
|
||||
Finds the point(s) where a curve intersects a given X-value.
|
||||
|
||||
This is a low-level variant
|
||||
This is a low-level variant
|
||||
of [`Path.intersectsX()`](/en/docs/developer/api/path/#pathintersectsx).
|
||||
Instead of a path, you describe a single curve by passing the four
|
||||
points that describes it.
|
||||
|
||||
This returns `false` if no intersections are found,
|
||||
a [Point](/en/docs/developer/api/point/) object if
|
||||
a single intersection is found, and an array
|
||||
of [Point](/en/docs/developer/api/point/) objects if
|
||||
This returns `false` if no intersections are found,
|
||||
a [Point](/en/docs/developer/api/point/) object if
|
||||
a single intersection is found, and an array
|
||||
of [Point](/en/docs/developer/api/point/) objects if
|
||||
multiple intersections are found.
|
||||
|
||||
<Example part="utils_curveintersectsx" caption="A Utils.curveIntersectX() example" />
|
||||
|
@ -69,4 +69,3 @@ for (let p of utils.curveIntersectsX(
|
|||
))
|
||||
snippets[p.y] = new Snippet("notch", p);
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: curveIntersectsY()
|
||||
---
|
||||
***
|
||||
|
||||
## title: curveIntersectsY()
|
||||
|
||||
```js
|
||||
array | Point | false utils.curveIntersectsY(
|
||||
|
@ -13,15 +13,15 @@ array | Point | false utils.curveIntersectsY(
|
|||
|
||||
Finds the point(s) where a curve intersects a given Y-value.
|
||||
|
||||
This is a low-level variant
|
||||
This is a low-level variant
|
||||
of [`Path.intersectsY()`](/en/docs/developer/api/path/#pathintersectsy).
|
||||
Instead of a path, you describe a single curve by passing the four
|
||||
points that describes it.
|
||||
|
||||
This returns `false` if no intersections are found,
|
||||
a [Point](/en/docs/developer/api/point/) object if
|
||||
a single intersection is found, and an array
|
||||
of [Point](/en/docs/developer/api/point/) objects if
|
||||
This returns `false` if no intersections are found,
|
||||
a [Point](/en/docs/developer/api/point/) object if
|
||||
a single intersection is found, and an array
|
||||
of [Point](/en/docs/developer/api/point/) objects if
|
||||
multiple intersections are found.
|
||||
|
||||
<Example part="utils_curveintersectsy" caption="A Utils.curveIntersectY() example" />
|
||||
|
@ -69,4 +69,3 @@ for (let p of utils.curveIntersectsY(
|
|||
))
|
||||
snippets[p.x] = new Snippet("notch", p);
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: curvesIntersect()
|
||||
---
|
||||
***
|
||||
|
||||
## title: curvesIntersect()
|
||||
|
||||
```js
|
||||
array | false utils.curvesIntersect(
|
||||
|
@ -58,4 +58,3 @@ for (let p of utils.curvesIntersect(
|
|||
snippets[part.getId()] = new Snippet("notch", p);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: deg2rad()
|
||||
---
|
||||
***
|
||||
|
||||
## title: deg2rad()
|
||||
|
||||
```js
|
||||
float deg2rad(float degrees)
|
||||
|
@ -10,4 +10,3 @@ Returns the degrees you pass to it as radians.
|
|||
|
||||
This is useful for when you use methods like `Math.cos()` that expects a corner
|
||||
in radians, when we typically use degrees.
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Utils
|
||||
order: 95
|
||||
---
|
||||
---------
|
||||
|
||||
The `Utils` object provides the following utility methods to facilitate your work:
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue