From 42b8207079101417c5f3621c2a9b1af41f062ea8 Mon Sep 17 00:00:00 2001 From: joostdecock Date: Sun, 11 Sep 2022 16:39:52 +0200 Subject: [PATCH] chore(sandy): Port to v3 stage 2 --- designs/sandy/src/curved-waistband.mjs | 32 ++++++++--------- designs/sandy/src/skirt.mjs | 45 +++++++++++++----------- designs/sandy/src/straight-waistband.mjs | 30 ++++++++-------- designs/sandy/src/waistband.mjs | 8 ++--- 4 files changed, 59 insertions(+), 56 deletions(-) diff --git a/designs/sandy/src/curved-waistband.mjs b/designs/sandy/src/curved-waistband.mjs index fffa3e31ebf..b440c8cf7e6 100644 --- a/designs/sandy/src/curved-waistband.mjs +++ b/designs/sandy/src/curved-waistband.mjs @@ -1,26 +1,26 @@ import { draftRingSector } from './shared.mjs' -export function draftCurvedWaistband(part) { +export function draftCurvedWaistband({ + utils, + store, + sa, + points, + Path, + paths, + Snippet, + snippets, + options, + complete, + paperless, + macro, + absoluteOptions, + part, +}) { /** * The curved waistband is just a ring sector with external * and intenal radius and angle calculated from measurements * and options */ - const { - utils, - store, - sa, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - absoluteOptions, - } = part.shorthand() // Calculate the angle of the ring sector and the radius of the upper arc const an = diff --git a/designs/sandy/src/skirt.mjs b/designs/sandy/src/skirt.mjs index f37f27c2fcd..74a97c18a12 100644 --- a/designs/sandy/src/skirt.mjs +++ b/designs/sandy/src/skirt.mjs @@ -3,24 +3,23 @@ import { pctBasedOn } from '@freesewing/core' import { pluginBundle } from '@freesewing/plugin-bundle' import { elastics } from '@freesewing/snapseries' -function sandySkirt(part) { - const { - utils, - store, - sa, - points, - Path, - paths, - Snippet, - snippets, - options, - measurements, - complete, - paperless, - macro, - absoluteOptions, - } = part.shorthand() - +function sandySkirt({ + utils, + store, + sa, + points, + Path, + paths, + Snippet, + snippets, + options, + measurements, + complete, + paperless, + macro, + absoluteOptions, + part, +}) { // Circumference of the top of the waistband, calculated from the waistbandPosition option store.set( 'topCircumference', @@ -219,8 +218,14 @@ export const skirt = { options: { minimumOverlap: 15, // Lower than this and we don't draw a button seamlessFullCircle: { bool: false, menu: 'construction' }, - waistbandWidth: { pct: 4, min: 1, max: 8, snap: elastics, - ...pctBasedOn('waistToFloor'), menu: 'style' }, + waistbandWidth: { + pct: 4, + min: 1, + max: 8, + snap: elastics, + ...pctBasedOn('waistToFloor'), + menu: 'style', + }, waistbandPosition: { pct: 50, min: 0, max: 100, menu: 'fit' }, lengthBonus: { pct: 50, min: 10, max: 100, menu: 'style' }, circleRatio: { pct: 50, min: 20, max: 100, menu: 'style' }, diff --git a/designs/sandy/src/straight-waistband.mjs b/designs/sandy/src/straight-waistband.mjs index ef85bff44b6..cb72dcd568e 100644 --- a/designs/sandy/src/straight-waistband.mjs +++ b/designs/sandy/src/straight-waistband.mjs @@ -1,22 +1,22 @@ -export function draftStraightWaistband(part) { +export function draftStraightWaistband({ + store, + sa, + Point, + points, + Path, + paths, + Snippet, + snippets, + complete, + paperless, + macro, + absoluteOptions, + part, +}) { /** * The straight waistband is just a rectangle with the width * of double the waistband width, since it will be folded */ - const { - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - complete, - paperless, - macro, - absoluteOptions, - } = part.shorthand() // Calculate the corners of the rectangle and other auxiliar points points.center = new Point(0, 0) diff --git a/designs/sandy/src/waistband.mjs b/designs/sandy/src/waistband.mjs index 1475cfe3ee4..745936a041e 100644 --- a/designs/sandy/src/waistband.mjs +++ b/designs/sandy/src/waistband.mjs @@ -1,11 +1,9 @@ import { draftStraightWaistband } from './straight-waistband.mjs' import { draftCurvedWaistband } from './curved-waistband.mjs' -const sandyWaistband = (part) => { - const { options } = part.shorthand() - - if (options.waistbandShape === 'curved') return draftCurvedWaistband(part) - else return draftStraightWaistband(part) +const sandyWaistband = (params) => { + if (params.options.waistbandShape === 'curved') return draftCurvedWaistband(params) + else return draftStraightWaistband(params) } export const waistband = {