diff --git a/CHANGELOG.md b/CHANGELOG.md index c104be29599..f250548856c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ - Removed lingering console.log statements +### sandy + +#### Changed + + - Migrated the `waistbandWidth` option from mm to snapped pct + ### titan #### Changed diff --git a/config/changelog.yaml b/config/changelog.yaml index 082d0efdbfa..fd8ec3ce85b 100644 --- a/config/changelog.yaml +++ b/config/changelog.yaml @@ -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 diff --git a/packages/sandy/CHANGELOG.md b/packages/sandy/CHANGELOG.md index fbca38d2568..991a6102151 100644 --- a/packages/sandy/CHANGELOG.md +++ b/packages/sandy/CHANGELOG.md @@ -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 diff --git a/packages/sandy/config/index.js b/packages/sandy/config/index.js index 0988eeaa3cb..62569934f9d 100644 --- a/packages/sandy/config/index.js +++ b/packages/sandy/config/index.js @@ -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 }, diff --git a/packages/sandy/src/curved-waistband.js b/packages/sandy/src/curved-waistband.js index 4e81812b420..04c19da2fcf 100644 --- a/packages/sandy/src/curved-waistband.js +++ b/packages/sandy/src/curved-waistband.js @@ -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' ) diff --git a/packages/sandy/src/skirt.js b/packages/sandy/src/skirt.js index 9a02f1e4e24..0f5c963e671 100644 --- a/packages/sandy/src/skirt.js +++ b/packages/sandy/src/skirt.js @@ -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 diff --git a/packages/sandy/src/straight-waistband.js b/packages/sandy/src/straight-waistband.js index 08b37fbcd42..b3050e967d3 100644 --- a/packages/sandy/src/straight-waistband.js +++ b/packages/sandy/src/straight-waistband.js @@ -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()