1
0
Fork 0

fix(sandy): Ported mm option to snapped pct

This commit is contained in:
joostdecock 2021-10-29 16:06:28 +02:00
parent 6818cfc92e
commit 980f4e47c2
7 changed files with 28 additions and 10 deletions

View file

@ -9,6 +9,12 @@
- Removed lingering console.log statements
### sandy
#### Changed
- Migrated the `waistbandWidth` option from mm to snapped pct
### titan
#### Changed

View file

@ -9,6 +9,8 @@ unreleased:
- Migrated the `waistbandWidth` option from mm to snapped pct
trayvon:
- Migrated the `knotWidth` and `tipWidth` options from mm to snapped pct
sandy:
- Migrated the `waistbandWidth` option from mm to snapped pct
2.19.1:
date: 2021-10-23

View file

@ -1,6 +1,12 @@
# Change log for: @freesewing/sandy
## unreleased (NaN-NaN-NaN)
### Changed
- Migrated the `waistbandWidth` option from mm to snapped pct
## 2.16.1 (2021-05-30)
### Changed

View file

@ -1,4 +1,7 @@
import { version } from '../package.json'
import { elastics } from '@freesewing/snapseries'
import freesewing from '@freesewing/core'
const { pctBasedOn } = freesewing
export default {
name: 'sandy',
@ -24,10 +27,8 @@ export default {
// Bool
seamlessFullCircle: { bool: false },
// Millimeter
waistbandWidth: { mm: 40, min: 5, max: 150 },
// Percentages
waistbandWidth: { pct: 4, min: 1, max: 8, snap: elastics, ...pctBasedOn('waistToFloor') },
waistbandPosition: { pct: 50, min: 0, max: 100 },
lengthBonus: { pct: 50, min: 10, max: 100 },
circleRatio: { pct: 50, min: 20, max: 100 },

View file

@ -19,22 +19,23 @@ export default function (part) {
complete,
paperless,
macro,
absoluteOptions,
} = part.shorthand()
// Calculate the angle of the ring sector and the radius of the upper arc
const an =
utils.rad2deg(store.get('bottomCircumference') - store.get('topCircumference')) /
options.waistbandWidth
absuluteOptions.waistbandWidth
const rad = store.get('topCircumference') / utils.deg2rad(an)
// Extra angle to extend the waistband to overlap according to waistbandOverlap
const anExtra = utils.rad2deg(store.get('waistbandOverlap') / (rad + options.waistbandWidth))
const anExtra = utils.rad2deg(store.get('waistbandOverlap') / (rad + absoluteOptions.waistbandWidth))
// The curved waistband is shown with no rotation
const rot = 0
// Call draftRingSector to draft the part
paths.seam = draftRingSector(part, rot, an + anExtra, rad, rad + options.waistbandWidth).attr(
paths.seam = draftRingSector(part, rot, an + anExtra, rad, rad + absoluteOptions.waistbandWidth).attr(
'class',
'fabric'
)

View file

@ -15,6 +15,7 @@ export default function (part) {
complete,
paperless,
macro,
absoluteOptions,
} = part.shorthand()
// Circumference of the top of the waistband, calculated from the waistbandPosition option
@ -29,7 +30,7 @@ export default function (part) {
store.set(
'bottomCircumference',
store.get('topCircumference') +
(options.waistbandWidth * (measurements.hips - measurements.waist)) /
(absoluteOptions.waistbandWidth * (measurements.hips - measurements.waist)) /
measurements.waistToHips
)
} else {
@ -83,7 +84,7 @@ export default function (part) {
* arc with the length of the skirt added
*/
let radiusHem =
radiusWaist + store.get('fullLength') * options.lengthBonus - options.waistbandWidth
radiusWaist + store.get('fullLength') * options.lengthBonus - absoluteOptions.waistbandWidth
/**
* The ring sector will be rotated an angle an/2 so we

View file

@ -16,6 +16,7 @@ export default function (part) {
complete,
paperless,
macro,
absoluteOptions,
} = part.shorthand()
// Calculate the corners of the rectangle and other auxiliar points
@ -25,8 +26,8 @@ export default function (part) {
store.get('topCircumference') / 2 + store.get('waistbandOverlap'),
0
)
points.topRight = points.centerRight.shift(90, options.waistbandWidth)
points.topLeft = points.centerLeft.shift(90, options.waistbandWidth)
points.topRight = points.centerRight.shift(90, absoluteOptions.waistbandWidth)
points.topLeft = points.centerLeft.shift(90, absoluteOptions.waistbandWidth)
points.bottomRight = points.topRight.flipY()
points.bottomLeft = points.topLeft.flipY()