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 - Removed lingering console.log statements
### sandy
#### Changed
- Migrated the `waistbandWidth` option from mm to snapped pct
### titan ### titan
#### Changed #### Changed

View file

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

View file

@ -1,6 +1,12 @@
# Change log for: @freesewing/sandy # 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) ## 2.16.1 (2021-05-30)
### Changed ### Changed

View file

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

View file

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

View file

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

View file

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