Merge pull request 'fix(dev:docs): Dimension macro, boundary box, and typo fixes' (#375) from BenJamesBen/freesewing:additional-docs-reverts into develop
Reviewed-on: https://codeberg.org/freesewing/freesewing/pulls/375 Reviewed-by: Joost De Cock <joostdecock@noreply.codeberg.org>
This commit is contained in:
commit
eb20f7917d
13 changed files with 66 additions and 30 deletions
|
@ -12,7 +12,7 @@ instead, thereby overwriting the value of the attribute.
|
|||
|
||||
```js
|
||||
|
||||
Part Part.attr(
|
||||
Part Part.attr(
|
||||
string name,
|
||||
mixed value,
|
||||
bool overwrite = false
|
||||
|
@ -46,7 +46,11 @@ paths.line = new Path()
|
|||
.close()
|
||||
.addText('I have been flipped!', 'left')
|
||||
|
||||
part.attr('transform', 'scale(1,-1) translate(0,-40)')
|
||||
paths.bbox = new Path()
|
||||
.move(new Point(0,-40))
|
||||
.move(new Point(120,60))
|
||||
|
||||
part.attr('transform', 'scale(1,-1) translate(0,-40)')
|
||||
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ Number path.roughLength()
|
|||
|
||||
## Example
|
||||
|
||||
<Example caption="Example of the Path.attr() method">
|
||||
<Example caption="Example of the Path.roughLength() method">
|
||||
```js
|
||||
({ Point, points, Path, paths, macro, units, part }) => {
|
||||
|
||||
|
@ -27,12 +27,16 @@ Number path.roughLength()
|
|||
|
||||
macro("pd", {
|
||||
path: paths.example,
|
||||
id: 'macro1',
|
||||
d: -10,
|
||||
force: true,
|
||||
text: `Path.roughLength() = ${units(paths.example.roughLength())}`
|
||||
})
|
||||
macro("pd", {
|
||||
path: paths.example,
|
||||
id: 'macro2',
|
||||
d: 10,
|
||||
force: true,
|
||||
text: `Path.length() = ${units(paths.example.length())}`
|
||||
})
|
||||
|
||||
|
|
|
@ -36,12 +36,16 @@ Path path.translate(float deltaX, float deltaY)
|
|||
macro("ld", {
|
||||
from: points.B,
|
||||
to: points.step1,
|
||||
noStartMarker: true
|
||||
noStartMarker: true,
|
||||
id: 'macro1',
|
||||
force: true,
|
||||
})
|
||||
macro("ld", {
|
||||
from: points.step1,
|
||||
to: points.step2,
|
||||
noStartMarker: true
|
||||
noStartMarker: true,
|
||||
id: 'macro2',
|
||||
force: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
|
|
@ -35,8 +35,7 @@ This method is chainable as it returns the `Path` object
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
````
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
||||
|
@ -48,4 +47,4 @@ as the two following calls yield the same result:
|
|||
```js
|
||||
path.curve(point1, point1, point2)
|
||||
path._curve(point1, point2)
|
||||
````
|
||||
```
|
||||
|
|
|
@ -27,7 +27,9 @@ Point point.shift(float angle, float distance)
|
|||
macro("ld", {
|
||||
from: points.B,
|
||||
to: points.A,
|
||||
d: -10
|
||||
d: -10,
|
||||
id: 'macro1',
|
||||
force: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
|
|
@ -38,13 +38,17 @@ Point point.shiftFractionTowards(Point target, float fraction)
|
|||
macro("ld", {
|
||||
from: points.C,
|
||||
to: points.A,
|
||||
d: -10
|
||||
d: -10,
|
||||
id: 'macro1',
|
||||
force: true,
|
||||
})
|
||||
|
||||
macro("ld", {
|
||||
from: points.B,
|
||||
to: points.A,
|
||||
d: 20
|
||||
d: 20,
|
||||
id: 'macro2',
|
||||
force: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
|
|
@ -31,7 +31,8 @@ Point point.shiftOutwards(Point target, float distance)
|
|||
macro("ld", {
|
||||
from: points.C,
|
||||
to: points.B,
|
||||
d: -10
|
||||
d: -10,
|
||||
force: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
|
|
@ -31,9 +31,15 @@ Point point.shiftTowards(Point target, float distance)
|
|||
macro("ld", {
|
||||
from: points.C,
|
||||
to: points.A,
|
||||
d: -10
|
||||
d: -10,
|
||||
force: true,
|
||||
})
|
||||
|
||||
// Boundary box
|
||||
paths.bbox = new Path()
|
||||
.move(new Point(10,10))
|
||||
.move(new Point(125,70))
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: Point.slope()
|
||||
---
|
||||
|
||||
The `Point.slope()` method returns the slope (dy/dx) of a line between two Points.
|
||||
The `Point.slope()` method returns the slope (dy/dx) of a line between two Points.
|
||||
|
||||
## Signature
|
||||
|
||||
|
@ -29,11 +29,15 @@ point.slope(otherPoint)
|
|||
from: points.A,
|
||||
to: points.B,
|
||||
y: points.B.y,
|
||||
id: 'macro1',
|
||||
force: true,
|
||||
})
|
||||
macro('vd', {
|
||||
to: points.B,
|
||||
from: points.A,
|
||||
x: 0,
|
||||
id: 'macro2',
|
||||
force: true,
|
||||
})
|
||||
|
||||
paths.line = new Path()
|
||||
|
|
|
@ -24,7 +24,7 @@ Positive values for `deltaY` will move the point downwards.
|
|||
|
||||
<Example caption="An example of the Point.translate() method">
|
||||
```js
|
||||
({ Point, points, Snippet, snippets, macro, part }) => {
|
||||
({ Point, points, Path, paths, Snippet, snippets, macro, part }) => {
|
||||
|
||||
points.A = new Point(10, 10).setText("Point A", "text-sm")
|
||||
points.B = points.A.translate(120, 60)
|
||||
|
@ -42,9 +42,15 @@ Positive values for `deltaY` will move the point downwards.
|
|||
from: points.A,
|
||||
to: points.B,
|
||||
text: "translate(120,60)",
|
||||
noStartMarker: true
|
||||
noStartMarker: true,
|
||||
force: true,
|
||||
})
|
||||
|
||||
// Bounding box
|
||||
paths.bbox = new Path()
|
||||
.move(new Point(10, 10))
|
||||
.move(new Point(130, 80))
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
|
|
@ -17,7 +17,7 @@ This method is chainable as it returns the `Snippet` object
|
|||
|
||||
## Example
|
||||
|
||||
<Example caption="An example of the Snippet.clone() method">
|
||||
<Example caption="An example of the Snippet.scale() method">
|
||||
```js
|
||||
({ Point, Path, paths, Snippet, snippets, part }) => {
|
||||
|
||||
|
|
|
@ -91,12 +91,12 @@ In other words, a measurement that captures an angle, rather than a distance.
|
|||
}}
|
||||
returns={{ type: 'boolean', desc: 'true of it is a degree measurement, false if not' }}
|
||||
/>
|
||||
```js import {isDegreeMeasurement} from '@freesewing/config'
|
||||
```js
|
||||
import {isDegreeMeasurement} from '@freesewing/config'
|
||||
|
||||
const result = isDegreeMeasurement('shoulderSlope')
|
||||
// result now holds: true
|
||||
|
||||
````
|
||||
```
|
||||
|
||||
### logoPath
|
||||
|
||||
|
@ -104,7 +104,7 @@ Holds a string that is the SVG pathstring for the FreeSewing logo, Skully.
|
|||
|
||||
```js
|
||||
import { logoPath } from '@freesewing/config'
|
||||
````
|
||||
```
|
||||
|
||||
<ConsoleButton data={all.logoPath} />
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@ tedious. There are macros to add titles to our pattern, or grainline
|
|||
indicators, a scalebox, and there's a macro to round corners. The `round`
|
||||
macro.
|
||||
|
||||
:::note You can find more information on the `round` macro in [the macros docs](/reference/macros/round/).:::
|
||||
:::note
|
||||
You can find more information on the `round` macro in [the macros docs](/reference/macros/round/).
|
||||
:::
|
||||
|
||||
We need a half circle here, but the `round` macro works on 90° angles, so
|
||||
we'll use it twice. As such, we'll add some points to guide the macro, and
|
||||
|
@ -49,28 +51,28 @@ function draftBib({
|
|||
let delta
|
||||
do {
|
||||
points.right = new Point(
|
||||
tweak * measurements.head / 10,
|
||||
tweak * measurements.head / 10,
|
||||
0
|
||||
)
|
||||
points.bottom = new Point(
|
||||
0,
|
||||
0,
|
||||
tweak * measurements.head / 12
|
||||
)
|
||||
|
||||
|
||||
points.rightCp1 = points.right.shift(
|
||||
90,
|
||||
90,
|
||||
points.bottom.dy(points.right) / 2
|
||||
)
|
||||
points.bottomCp2 = points.bottom.shift(
|
||||
0,
|
||||
0,
|
||||
points.bottom.dx(points.right) / 2
|
||||
)
|
||||
|
||||
|
||||
paths.quarterNeck = new Path()
|
||||
.move(points.right)
|
||||
.curve(
|
||||
points.rightCp1,
|
||||
points.bottomCp2,
|
||||
points.rightCp1,
|
||||
points.bottomCp2,
|
||||
points.bottom
|
||||
)
|
||||
.hide()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue