Merge pull request #3974 from BenJamesBen/optional-measurements
fix(bob,penelope,docs): Access optional measurements via `measurements`
This commit is contained in:
commit
b1ec35b73c
6 changed files with 29 additions and 24 deletions
|
@ -16,7 +16,7 @@ export const bib = {
|
||||||
points,
|
points,
|
||||||
Path,
|
Path,
|
||||||
paths,
|
paths,
|
||||||
optionalMeasurements,
|
measurements,
|
||||||
options,
|
options,
|
||||||
macro,
|
macro,
|
||||||
log,
|
log,
|
||||||
|
@ -27,7 +27,7 @@ export const bib = {
|
||||||
part,
|
part,
|
||||||
}) => {
|
}) => {
|
||||||
// Head size
|
// Head size
|
||||||
const head = (optionalMeasurements?.head || 360) * options.headSize
|
const head = (`head` in measurements ? measurements.head : 360) * options.headSize
|
||||||
|
|
||||||
// Construct the neck opening
|
// Construct the neck opening
|
||||||
let tweak = 1
|
let tweak = 1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { pluginBundle } from '@freesewing/plugin-bundle'
|
import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||||
import { measurements, options, BuildMainShape } from './shape.mjs'
|
import { measurements, optionalMeasurements, options, BuildMainShape } from './shape.mjs'
|
||||||
|
|
||||||
function penelopeBack(params) {
|
function penelopeBack(params) {
|
||||||
const {
|
const {
|
||||||
|
@ -135,6 +135,7 @@ function penelopeBack(params) {
|
||||||
export const back = {
|
export const back = {
|
||||||
name: 'penelope.back',
|
name: 'penelope.back',
|
||||||
measurements,
|
measurements,
|
||||||
|
optionalMeasurements,
|
||||||
options,
|
options,
|
||||||
plugins: [pluginBundle],
|
plugins: [pluginBundle],
|
||||||
draft: penelopeBack,
|
draft: penelopeBack,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { pluginBundle } from '@freesewing/plugin-bundle'
|
import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||||
import { measurements, options, BuildMainShape } from './shape.mjs'
|
import { measurements, optionalMeasurements, options, BuildMainShape } from './shape.mjs'
|
||||||
|
|
||||||
function penelopeFront(params) {
|
function penelopeFront(params) {
|
||||||
const { options, Path, points, paths, Snippet, snippets, complete, sa, paperless, macro, part } =
|
const { options, Path, points, paths, Snippet, snippets, complete, sa, paperless, macro, part } =
|
||||||
|
@ -60,6 +60,7 @@ function penelopeFront(params) {
|
||||||
export const front = {
|
export const front = {
|
||||||
name: 'penelope.front',
|
name: 'penelope.front',
|
||||||
measurements,
|
measurements,
|
||||||
|
optionalMeasurements,
|
||||||
options,
|
options,
|
||||||
plugins: [pluginBundle],
|
plugins: [pluginBundle],
|
||||||
draft: penelopeFront,
|
draft: penelopeFront,
|
||||||
|
|
|
@ -38,21 +38,7 @@ export const options = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BuildMainShape(
|
export function BuildMainShape(
|
||||||
{
|
{ sa, options, measurements, Point, Path, points, paths, store, paperless, macro, part, log },
|
||||||
sa,
|
|
||||||
options,
|
|
||||||
measurements,
|
|
||||||
optionalMeasurements,
|
|
||||||
Point,
|
|
||||||
Path,
|
|
||||||
points,
|
|
||||||
paths,
|
|
||||||
store,
|
|
||||||
paperless,
|
|
||||||
macro,
|
|
||||||
part,
|
|
||||||
log,
|
|
||||||
},
|
|
||||||
frontPart
|
frontPart
|
||||||
) {
|
) {
|
||||||
let skirtLength = measurements.waistToKnee * (1 + options.lengthBonus) // + options.hem;
|
let skirtLength = measurements.waistToKnee * (1 + options.lengthBonus) // + options.hem;
|
||||||
|
@ -82,14 +68,13 @@ export function BuildMainShape(
|
||||||
store.set('nrOfDarts', nrOfDarts)
|
store.set('nrOfDarts', nrOfDarts)
|
||||||
store.set('dartSize', dartSize)
|
store.set('dartSize', dartSize)
|
||||||
|
|
||||||
if (optionalMeasurements?.seatBack) {
|
if ('seatBack' in measurements) {
|
||||||
seat = (frontPart ? seat - optionalMeasurements.seatBack : optionalMeasurements.seatBack) * 2
|
seat = (frontPart ? seat - measurements.seatBack : measurements.seatBack) * 2
|
||||||
} else {
|
} else {
|
||||||
seat *= 1 + (frontPart ? -1 : 1) * options.sideSeamShiftPercentage
|
seat *= 1 + (frontPart ? -1 : 1) * options.sideSeamShiftPercentage
|
||||||
}
|
}
|
||||||
if (optionalMeasurements?.waistBack) {
|
if ('waistBack' in measurements) {
|
||||||
waist =
|
waist = (frontPart ? waist - measurements.waistBack : measurements.waistBack) * 2
|
||||||
(frontPart ? waist - optionalMeasurements.waistBack : optionalMeasurements.waistBack) * 2
|
|
||||||
} else {
|
} else {
|
||||||
waist *= 1 + (frontPart ? -1 : 1) * options.sideSeamShiftPercentage
|
waist *= 1 + (frontPart ? -1 : 1) * options.sideSeamShiftPercentage
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,3 +38,12 @@ const part = {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
|
||||||
|
Although they are specified via the part configuration `optionalMeasurements`
|
||||||
|
property, optional measurements are accessed via the 'measurements'
|
||||||
|
settings property.
|
||||||
|
|
||||||
|
(There is no `optionalMeasurements` settings property.)`
|
||||||
|
|
||||||
|
</Tip>
|
||||||
|
|
|
@ -39,3 +39,12 @@ const pattern = new Aaron({
|
||||||
|
|
||||||
Measurements should always be specified in millimeter, unless it's an angle
|
Measurements should always be specified in millimeter, unless it's an angle
|
||||||
measurement (like `shoulderSlope`) which should be provided in degrees.
|
measurement (like `shoulderSlope`) which should be provided in degrees.
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
|
||||||
|
The `measurements` settings property is used to hold __all__ measurements,
|
||||||
|
both regular measurements as well as any optional measurements.
|
||||||
|
|
||||||
|
(There is no `optionalMeasurements` settings property.)
|
||||||
|
|
||||||
|
</Tip>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue