diff --git a/packages/simon/config/index.js b/packages/simon/config/index.js index 4baec799cbc..ca64a4d5a7a 100644 --- a/packages/simon/config/index.js +++ b/packages/simon/config/index.js @@ -192,14 +192,14 @@ export default { collarStandCurve: { deg: 2, min: 0, max: 5 }, collarFlare: { deg: 4, min: 0, max: 10 }, - // Millimeter - buttonPlacketWidth: { mm: 20, min: 10, max: 30 }, - buttonholePlacketWidth: { mm: 35, min: 20, max: 45 }, - buttonholePlacketFoldWidth: { mm: 6, min: 3, max: 10 }, - collarStandWidth: { mm: 35, min: 15, max: 60 }, - sleevePlacketWidth: { mm: 25, min: 15, max: 35 }, - boxPleatWidth: { mm: 35, min: 5, max: 65 }, - boxPleatFold: { mm: 5, min: 1, max: 15 }, + // Used to be millimeter (now pct) + buttonPlacketWidth: { pct: 5, min: 2, max: 8 }, + buttonholePlacketWidth: { pct: 8, min: 4, max: 12 }, + buttonholePlacketFoldWidth: { pct: 16, min: 8, max: 24 }, + collarStandWidth: { pct: 8, min: 3, max: 13 }, + sleevePlacketWidth: { pct: 13, min: 8, max: 18 }, + boxPleatWidth: { pct: 7, min: 4, max: 10 }, + boxPleatFold: { pct: 15, min: 10, max: 20 }, // Percentages acrossBackFactor: { pct: 97, min: 93, max: 100 }, diff --git a/packages/simon/src/back.js b/packages/simon/src/back.js index 3a18aebe30b..dbdcbc2a5a0 100644 --- a/packages/simon/src/back.js +++ b/packages/simon/src/back.js @@ -1,7 +1,7 @@ import { calculateReduction } from './shared' export default (part) => { - let { + const { store, measurements, sa, @@ -17,6 +17,15 @@ export default (part) => { options, } = part.shorthand() + // Add pct options (that used to be mm) to the store + store.set('buttonPlacketWidth', measurements.neck * options.buttonPlacketWidth) + store.set('buttonholePlacketWidth', measurements.neck * options.buttonholePlacketWidth) + store.set('buttonholePlacketFoldWidth', store.get('buttonholePlacketWidth') * options.buttonholePlacketFoldWidth) + store.set('collarStandWidth', measurements.neck * options.collarStandWidth) + store.set('sleevePlacketWidth', measurements.wrist * options.sleevePlacketWidth) + store.set('boxPleatWidth', measurements.shoulderToShoulder * options.boxPleatWidth) + store.set('boxPleatFold', store.get('boxPleatWidth') * options.boxPleatFold) + // Populare store with data we need calculateReduction(part) store.set( @@ -28,6 +37,7 @@ export default (part) => { .join(paths.backArmhole) .length() ) + // Hip shaping points.hips = points.hips.shift(180, store.get('hipsReduction') / 4) points.hem = points.hem.shift(180, store.get('hipsReduction') / 4) @@ -122,16 +132,16 @@ export default (part) => { // Box pleat if (options.boxPleat) { points.boxPleatLeft = paths.roundedBack - ? points.cbTop.shift(0, options.boxPleatWidth / 2) - : points.cbYoke.shift(0, options.boxPleatWidth / 2) - points.boxPleatMid = points.boxPleatLeft.shift(0, options.boxPleatFold) - points.boxPleatRight = points.boxPleatMid.shift(0, options.boxPleatFold) + ? points.cbTop.shift(0, store.get('boxPleatWidth') / 2) + : points.cbYoke.shift(0, store.get('boxPleatWidth') / 2) + points.boxPleatMid = points.boxPleatLeft.shift(0, store.get('boxPleatFold')) + points.boxPleatRight = points.boxPleatMid.shift(0, store.get('boxPleatFold')) points.boxPleatLeftBottom = new Point(points.boxPleatLeft.x, points.armholeHollowCp2.y) points.boxPleatMidBottom = new Point(points.boxPleatMid.x, points.armholeHollowCp2.y) points.boxPleatRightBottom = new Point(points.boxPleatRight.x, points.armholeHollowCp2.y) paths.armhole.setRender(true).attr('class', 'stroke-xl highlight debug canvas') - paths.armhole = paths.armhole.translate(options.boxPleatFold * 2, 0) - for (let p of [ + paths.armhole = paths.armhole.translate(store.get('boxPleatFold') * 2, 0) + for (const p of [ 'armholePitch', 'armholePitchCp1', 'armholeHollowCp2', @@ -141,7 +151,7 @@ export default (part) => { 'armhole', 'armholeYokeSplit', ]) - points[p] = points[p].shift(0, options.boxPleatFold * 2) + points[p] = points[p].shift(0, store.get('boxPleatFold') * 2) } // Draft hem diff --git a/packages/simon/src/buttonholeplacket.js b/packages/simon/src/buttonholeplacket.js index ef3d2a9e6da..ad630566515 100644 --- a/packages/simon/src/buttonholeplacket.js +++ b/packages/simon/src/buttonholeplacket.js @@ -1,7 +1,7 @@ import { addButtonHoles } from './shared' export default (part) => { - let { + const { utils, sa, Point, @@ -23,9 +23,9 @@ export default (part) => { return part } - for (let id in paths) delete part.paths[id] - let width = options.buttonholePlacketWidth - let fold = options.buttonholePlacketFoldWidth + for (const id in paths) delete part.paths[id] + const width = store.get('buttonholePlacketWidth') + const fold = store.get('buttonholePlacketFoldWidth') points.topInnerEdge = utils.lineIntersectsCurve( new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20), @@ -140,7 +140,7 @@ export default (part) => { // Paperless? if (paperless) { let offset = 0 - for (let pid of [ + for (const pid of [ 'placketBottomOuterEdgeUnder', 'placketBottomOuterEdgeFold', 'placketBottomOuterEdgeOver', diff --git a/packages/simon/src/buttonplacket.js b/packages/simon/src/buttonplacket.js index 5cdbcab9f08..61078be4fb6 100644 --- a/packages/simon/src/buttonplacket.js +++ b/packages/simon/src/buttonplacket.js @@ -1,7 +1,7 @@ import { addButtons } from './shared' export default (part) => { - let { + const { utils, sa, Point, @@ -23,11 +23,11 @@ export default (part) => { return part } - for (let id in paths) { + for (const id in paths) { if (id !== 'seam') delete part.paths[id] } macro('flip') - let width = options.buttonPlacketWidth + const width = store.get('buttonPlacketWidth') points.placketTopIn = utils.lineIntersectsCurve( new Point(width / -2, points.cfNeck.y + 20), new Point(width / -2, points.cfNeck.y - 20), diff --git a/packages/simon/src/collar.js b/packages/simon/src/collar.js index 21524834332..8776e21331f 100644 --- a/packages/simon/src/collar.js +++ b/packages/simon/src/collar.js @@ -1,10 +1,10 @@ export default (part) => { - let { measurements, utils, sa, Point, points, Path, paths, complete, paperless, macro, options } = + const { store, measurements, utils, sa, Point, points, Path, paths, complete, paperless, macro, options } = part.shorthand() const draft = function (tweak = 1) { - let length = measurements.neck * (1 + options.collarEase - options.collarGap) * tweak - let width = options.collarStandWidth * (1 + options.collarRoll) + const length = measurements.neck * (1 + options.collarEase - options.collarGap) * tweak + const width = store.get('collarStandWidth') * (1 + options.collarRoll) // Draft right side points.topMid = new Point(0, 0) @@ -62,7 +62,7 @@ export default (part) => { // Complete pattern? if (complete) { // Draw undercollar line - let uc = points.topMid.dist(points.bottomMid) * 0.05 + const uc = points.topMid.dist(points.bottomMid) * 0.05 points.ucTopMid = points.topMid.shift(-90, uc) points.ucRightTopHinge = points.rightTopHinge.shift(-90, uc) points.ucRightTopHingeCp1 = points.rightTopHingeCp1.shift(-90, uc) diff --git a/packages/simon/src/collarstand.js b/packages/simon/src/collarstand.js index 3b4cdbb92dd..c403abb8255 100644 --- a/packages/simon/src/collarstand.js +++ b/packages/simon/src/collarstand.js @@ -1,6 +1,7 @@ export default (part) => { - let { + const { measurements, + store, sa, Point, points, @@ -15,12 +16,12 @@ export default (part) => { } = part.shorthand() const draft = function (tweak = 1) { - let length = measurements.neck * (1 + options.collarEase) * tweak - let width = options.collarStandWidth - let half = length / 2 - let bend = options.collarStandBend * -1 - let curve = options.collarStandCurve - options.collarStandBend - let hinge = 90 + (bend + curve) / 2 + const length = measurements.neck * (1 + options.collarEase) * tweak + const width = store.get('collarStandWidth') + const half = length / 2 + const bend = options.collarStandBend * -1 + const curve = options.collarStandCurve - options.collarStandBend + const hinge = 90 + (bend + curve) / 2 // Center line points.center = new Point(0, 0) @@ -34,7 +35,7 @@ export default (part) => { points.rightBottomHinge = points.hinge.shift(180 + hinge, width / 2) points.rightTopCf = points.rightCf.shift(curve + 90, width / 2) points.rightBottomCf = points.rightCf.shift(curve - 90, width / 2) - points.rightBottomEdge = points.rightBottomCf.shift(curve, options.buttonholePlacketWidth / 2) + points.rightBottomEdge = points.rightBottomCf.shift(curve, store.get('buttonholePlacketWidth') / 2) // Add control points (right side only) points.bottomMidCp2 = points.bottomMid.shift(0, half * 0.2) @@ -42,12 +43,12 @@ export default (part) => { points.rightBottomHingeCp2 = points.rightBottomHinge.shift(hinge - 90, half * 0.1) points.rightBottomCfCp1 = points.rightBottomCf.shift(180 + curve, half * 0.1) points.rightBottomEdgeCp2 = points.rightBottomCf.rotate(-90, points.rightBottomEdge) - points.rightTopCfCp1 = points.rightTopCf.shift(curve, options.buttonholePlacketWidth / 2) + points.rightTopCfCp1 = points.rightTopCf.shift(curve, store.get('buttonholePlacketWidth') / 2) points.topMidCp1 = points.topMid.shift(0, half * 0.2) points.rightTopHingeCp2 = points.rightTopHinge.shift(90 + hinge, half * 0.2) points.rightTopHingeCp1 = points.rightTopHinge.shift(hinge - 90, half * 0.1) points.topEdgeCp1 = points.rightTopCf.rotate(-90, points.rightBottomEdge) - points.rightTopCfCp2 = points.rightTopCf.shift(180 + curve, options.buttonholePlacketWidth / 2) + points.rightTopCfCp2 = points.rightTopCf.shift(180 + curve, store.get('buttonholePlacketWidth') / 2) // Now do the left side points.leftCf = points.rightCf.flipX() @@ -58,8 +59,8 @@ export default (part) => { points.leftTopCfCp1 = points.rightTopCfCp2.flipX() points.leftTopCf = points.rightTopCf.flipX() points.leftBottomCf = points.rightBottomCf.flipX() - points.leftBottomEdge = points.leftBottomCf.shift(bend + 180, options.buttonPlacketWidth / 2) - points.leftTopCfCp2 = points.leftTopCf.shift(bend + 180, options.buttonPlacketWidth / 2) + points.leftBottomEdge = points.leftBottomCf.shift(bend + 180, store.get('buttonPlacketWidth') / 2) + points.leftTopCfCp2 = points.leftTopCf.shift(bend + 180, store.get('buttonPlacketWidth') / 2) points.leftBottomEdgeCp1 = points.leftBottomCf.rotate(90, points.leftBottomEdge) points.leftBottomCfCp2 = points.rightBottomCfCp1.flipX() points.leftBottomHingeCp1 = points.rightBottomHingeCp2.flipX() @@ -144,7 +145,7 @@ export default (part) => { // Button and buttonhole snippets.button = new Snippet('button', points.leftCf) - let angle = options.collarStandCurve - options.collarStandBend - 180 + const angle = options.collarStandCurve - options.collarStandBend - 180 points.buttonhole = points.rightCf.shift(angle, 3) snippets.buttonhole = new Snippet('buttonhole', points.buttonhole).attr( 'data-rotate', @@ -200,7 +201,7 @@ export default (part) => { macro('ld', { from: points.rightBottomCf, to: points.rightTopCf, - d: -15 - sa - options.buttonholePlacketWidth / 2, + d: -15 - sa - store.get('buttonholePlacketWidth') / 2, }) macro('vd', { from: points.rightBottomCf, diff --git a/packages/simon/src/cuff-barrel-angled.js b/packages/simon/src/cuff-barrel-angled.js index aa043a69c5e..61cff6a26f1 100644 --- a/packages/simon/src/cuff-barrel-angled.js +++ b/packages/simon/src/cuff-barrel-angled.js @@ -1,10 +1,10 @@ import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared' export default (part) => { - let { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand() + const { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand() draftBarrelCuff(part) - let height = store.get('cuffHeight') + const height = store.get('cuffHeight') points.leftAngleTop = points.topLeft.shift(0, height / 3) points.leftAngleBottom = points.topLeft.shift(-90, height / 3) diff --git a/packages/simon/src/cuff-barrel-rounded.js b/packages/simon/src/cuff-barrel-rounded.js index d496dfaddbf..9f7210042b9 100644 --- a/packages/simon/src/cuff-barrel-rounded.js +++ b/packages/simon/src/cuff-barrel-rounded.js @@ -4,7 +4,7 @@ export default (part) => { let { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand() draftBarrelCuff(part) - let height = store.get('cuffHeight') + const height = store.get('cuffHeight') macro('round', { from: points.topRight, to: points.bottomLeft, diff --git a/packages/simon/src/cuff-barrel-straight.js b/packages/simon/src/cuff-barrel-straight.js index 039f7b49aae..474d1bec339 100644 --- a/packages/simon/src/cuff-barrel-straight.js +++ b/packages/simon/src/cuff-barrel-straight.js @@ -1,7 +1,7 @@ import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared' export default (part) => { - let { sa, points, Path, paths, complete, paperless } = part.shorthand() + const { sa, points, Path, paths, complete, paperless } = part.shorthand() draftBarrelCuff(part) paths.seam = new Path() diff --git a/packages/simon/src/cuff-french-angled.js b/packages/simon/src/cuff-french-angled.js index fdb58e68248..e2096a60474 100644 --- a/packages/simon/src/cuff-french-angled.js +++ b/packages/simon/src/cuff-french-angled.js @@ -1,10 +1,10 @@ import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared' export default (part) => { - let { store, sa, points, Path, paths, complete, paperless } = part.shorthand() + const { store, sa, points, Path, paths, complete, paperless } = part.shorthand() draftFrenchCuff(part) - let height = store.get('cuffHeight') + const height = store.get('cuffHeight') points.leftAngleTopTop = points.topLeft.shift(0, height / 3) points.leftAngleTopBottom = points.topLeft.shift(-90, height / 3) points.rightAngleTopTop = points.topRight.shift(180, height / 3) diff --git a/packages/simon/src/cuff-french-rounded.js b/packages/simon/src/cuff-french-rounded.js index 79b78142873..5fa4c8120be 100644 --- a/packages/simon/src/cuff-french-rounded.js +++ b/packages/simon/src/cuff-french-rounded.js @@ -1,9 +1,9 @@ import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared' export default (part) => { - let { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand() + const { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand() draftFrenchCuff(part) - let height = store.get('cuffHeight') + const height = store.get('cuffHeight') macro('round', { from: points.topRight, to: points.bottomLeft, diff --git a/packages/simon/src/cuff-french-straight.js b/packages/simon/src/cuff-french-straight.js index d31e48c2fd2..5e663cb7cee 100644 --- a/packages/simon/src/cuff-french-straight.js +++ b/packages/simon/src/cuff-french-straight.js @@ -1,7 +1,7 @@ import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared' export default (part) => { - let { sa, points, Path, paths, complete, paperless } = part.shorthand() + const { sa, points, Path, paths, complete, paperless } = part.shorthand() draftFrenchCuff(part) diff --git a/packages/simon/src/cuff.js b/packages/simon/src/cuff.js index 33d3f1cc9bb..4f33b1d62ea 100644 --- a/packages/simon/src/cuff.js +++ b/packages/simon/src/cuff.js @@ -6,7 +6,7 @@ import angledFrenchCuff from './cuff-french-angled' import roundedFrenchCuff from './cuff-french-rounded' export default (part) => { - let { options } = part.shorthand() + const { options } = part.shorthand() switch (options.cuffStyle) { case 'roundedBarrelCuff': return roundedBarrelCuff(part) diff --git a/packages/simon/src/front.js b/packages/simon/src/front.js index f5861e890db..b6991fd0426 100644 --- a/packages/simon/src/front.js +++ b/packages/simon/src/front.js @@ -1,14 +1,14 @@ import { calculateReduction } from './shared' export default (part) => { - let { store, measurements, sa, Point, points, Path, paths, complete, macro, snippets, options } = + const { store, measurements, sa, Point, points, Path, paths, complete, macro, snippets, options } = part.shorthand() // Clean up - for (let i in paths) { + for (const i in paths) { if (['frontArmhole', 'frontCollar'].indexOf(i) === -1) delete paths[i] } - for (let i in snippets) { + for (const i in snippets) { if (i.indexOf('otch')) delete snippets[i] } diff --git a/packages/simon/src/frontleft-classic-cuton.js b/packages/simon/src/frontleft-classic-cuton.js index 7f76bb4649c..bbbe1ad8bae 100644 --- a/packages/simon/src/frontleft-classic-cuton.js +++ b/packages/simon/src/frontleft-classic-cuton.js @@ -1,11 +1,11 @@ import { addButtonHoles } from './shared' export default (part) => { - let { sa, Point, points, Path, paths, snippets, complete, paperless, macro, options } = + const { store, sa, Point, points, Path, paths, snippets, complete, paperless, macro, options } = part.shorthand() - let fold = options.buttonholePlacketFoldWidth - let width = options.buttonholePlacketWidth + const fold = store.get('buttonholePlacketFoldWidth') + const width = store.get('buttonholePlacketWidth') points.placketCfNeck = points.cfNeck.shift(180, fold * 2) points.placketTopInnerEdgeFold = points.placketCfNeck.shift(0, width / 2) points.placketTopInnerEdgeOver = points.placketCfNeck.shift(0, width / 2 - fold) @@ -117,7 +117,7 @@ export default (part) => { to: points.hips, }) let offset = 0 - for (let pid of [ + for (const pid of [ 'placketTopOuterEdgeUnder', 'placketTopOuterEdgeFold', 'placketTopOuterEdgeOver', diff --git a/packages/simon/src/frontleft-classic-seperate.js b/packages/simon/src/frontleft-classic-seperate.js index 2b41eb3f258..4c8262a0184 100644 --- a/packages/simon/src/frontleft-classic-seperate.js +++ b/packages/simon/src/frontleft-classic-seperate.js @@ -1,8 +1,8 @@ export default (part) => { - let { utils, sa, Point, points, Path, paths, snippets, complete, paperless, macro, options } = + const { utils, sa, Point, points, Path, paths, store, snippets, complete, paperless, macro, options } = part.shorthand() - let fold = options.buttonholePlacketFoldWidth + const fold = store.get('buttonholePlacketFoldWidth') points.neckEdge = utils.lineIntersectsCurve( new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20), new Point(points.cfNeck.x + fold * 2, points.cfNeck.y - 20), @@ -69,7 +69,7 @@ export default (part) => { to: points.s3CollarSplit, x: points.neckEdge.x - sa - 30, }) - for (let pid of ['Armhole', 'Waist', 'Hips']) { + for (const pid of ['Armhole', 'Waist', 'Hips']) { macro('hd', { from: points['edge' + pid], to: points[pid.toLowerCase()], diff --git a/packages/simon/src/frontleft-seamless.js b/packages/simon/src/frontleft-seamless.js index 6d3995b8250..4bce007cea2 100644 --- a/packages/simon/src/frontleft-seamless.js +++ b/packages/simon/src/frontleft-seamless.js @@ -1,8 +1,8 @@ import { addButtonHoles } from './shared' export default (part) => { - let { sa, points, Path, paths, complete, paperless, macro, options } = part.shorthand() - let width = options.buttonholePlacketWidth + const { sa, points, Path, paths, complete, paperless, store, macro, options } = part.shorthand() + const width = store.get('buttonholePlacketWidth') points.placketCfNeck = points.cfNeck points.placketTopFold1 = points.cfNeck.shift(180, width / 2) points.placketTopFold2 = points.cfNeck.shift(180, width * 1.5) @@ -58,7 +58,7 @@ export default (part) => { // Paperless? if (paperless) { let offset = 0 - for (let pid of ['placketBottomFold2', 'placketBottomFold1', 'cfHem', 'hips']) { + for (const pid of ['placketBottomFold2', 'placketBottomFold1', 'cfHem', 'hips']) { offset += 15 macro('hd', { from: points.placketBottomEdge, diff --git a/packages/simon/src/frontleft.js b/packages/simon/src/frontleft.js index 492a9b6571f..9f2610aa937 100644 --- a/packages/simon/src/frontleft.js +++ b/packages/simon/src/frontleft.js @@ -4,7 +4,7 @@ import frontLeftClassicCuton from './frontleft-classic-cuton' import frontLeftSeamless from './frontleft-seamless' export default (part) => { - let { sa, options, complete, paperless, points, macro } = part.shorthand() + const { sa, options, complete, paperless, points, macro } = part.shorthand() if (complete && paperless) { frontDimensions(part, 'left') diff --git a/packages/simon/src/frontright-classic-cuton.js b/packages/simon/src/frontright-classic-cuton.js index 11676a2678c..5c4fc582f5f 100644 --- a/packages/simon/src/frontright-classic-cuton.js +++ b/packages/simon/src/frontright-classic-cuton.js @@ -1,10 +1,10 @@ import { addButtons } from './shared' export default (part) => { - let { utils, sa, Point, points, Path, paths, complete, paperless, macro, options } = + const { store, utils, sa, Point, points, Path, paths, complete, paperless, macro, options } = part.shorthand() - let width = options.buttonPlacketWidth + const width = store.get('buttonPlacketWidth') points.placketTopIn = utils.lineIntersectsCurve( new Point(width / -2, points.cfNeck.y + 20), new Point(width / -2, points.cfNeck.y - 20), diff --git a/packages/simon/src/frontright-classic-seperate.js b/packages/simon/src/frontright-classic-seperate.js index 06abef56f02..b1d67d99317 100644 --- a/packages/simon/src/frontright-classic-seperate.js +++ b/packages/simon/src/frontright-classic-seperate.js @@ -1,8 +1,8 @@ export default (part) => { - let { snippets, utils, sa, Point, points, paths, complete, paperless, macro, options } = + const { store, snippets, utils, sa, Point, points, paths, complete, paperless, macro, options } = part.shorthand() - let width = options.buttonPlacketWidth + const width = store.get('buttonPlacketWidth') points.placketTopIn = utils.lineIntersectsCurve( new Point(width / -2, points.cfNeck.y + 20), new Point(width / -2, points.cfNeck.y - 20), @@ -57,7 +57,7 @@ export default (part) => { to: points.placketTopIn, x: points.placketTopIn.x + sa + 15, }) - for (let pid of ['Armhole', 'Waist', 'Hips']) { + for (const pid of ['Armhole', 'Waist', 'Hips']) { macro('hd', { from: points['edge' + pid], to: points[pid.toLowerCase()], diff --git a/packages/simon/src/frontright-seamless.js b/packages/simon/src/frontright-seamless.js index 3d438301965..79e53b92e90 100644 --- a/packages/simon/src/frontright-seamless.js +++ b/packages/simon/src/frontright-seamless.js @@ -1,9 +1,9 @@ import { addButtons } from './shared' export default (part) => { - let { sa, Point, points, Path, paths, complete, paperless, macro, options } = part.shorthand() + const { sa, store, Point, points, Path, paths, complete, paperless, macro, options } = part.shorthand() - let width = options.buttonPlacketWidth + const width = store.get('buttonPlacketWidth') points.placketTopFold1 = points.cfNeck.shift(0, width / 2) points.placketTopFold2 = points.cfNeck.shift(0, width * 1.5) points.placketTopEdge = points.cfNeck.shift(0, width * 2.5) diff --git a/packages/simon/src/frontright.js b/packages/simon/src/frontright.js index 040f8ca46b8..204b712fa25 100644 --- a/packages/simon/src/frontright.js +++ b/packages/simon/src/frontright.js @@ -4,7 +4,7 @@ import frontRightClassicCuton from './frontright-classic-cuton' import frontRightSeamless from './frontright-seamless' export default (part) => { - let { sa, options, complete, paperless, points, macro, paths } = part.shorthand() + const { sa, options, complete, paperless, points, macro, paths } = part.shorthand() macro('flip') if (complete) { points.scalebox = points.waist.shiftFractionTowards(points.cfWaist, 0.5) diff --git a/packages/simon/src/index.js b/packages/simon/src/index.js index 9d2b22be3c2..8a31a81718b 100644 --- a/packages/simon/src/index.js +++ b/packages/simon/src/index.js @@ -33,7 +33,7 @@ Pattern.prototype.draftBackBase = function (part) { return new Brian(this.settings).draftBack(part) } Pattern.prototype.draftSleeveBase = function (part) { - let brian = new Brian(this.settings) + const brian = new Brian(this.settings) return brian.draftSleeve(brian.draftSleevecap(part)) } Pattern.prototype.draftBack = draftBack diff --git a/packages/simon/src/shared.js b/packages/simon/src/shared.js index 89c3fac4334..180cfcfa81b 100644 --- a/packages/simon/src/shared.js +++ b/packages/simon/src/shared.js @@ -1,8 +1,8 @@ export const calculateReduction = function (part) { - let { store, measurements, options } = part.shorthand() - let chest = measurements.chest * (1 + options.chestEase) - let waist = measurements.waist * (1 + options.waistEase) - let hips = measurements.hips * (1 + options.hipsEase) + const { store, measurements, options } = part.shorthand() + const chest = measurements.chest * (1 + options.chestEase) + const waist = measurements.waist * (1 + options.waistEase) + const hips = measurements.hips * (1 + options.hipsEase) let waistReduction = chest - waist let hipsReduction = chest - hips @@ -26,8 +26,8 @@ export const calculateReduction = function (part) { } export const addButtons = function (part, origin = 'cfNeck', snippet = 'button') { - let { points, options, snippets, Snippet } = part.shorthand() - let len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength) + const { points, options, snippets, Snippet } = part.shorthand() + const len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength) for (let i = 1; i <= options.buttons; i++) { points['button' + i] = points[origin].shift(-90, (len / options.buttons) * i) snippets[snippet + i] = new Snippet(snippet, points['button' + i]) @@ -42,9 +42,9 @@ export const addButtons = function (part, origin = 'cfNeck', snippet = 'button') export const addButtonHoles = (part, origin) => addButtons(part, origin, 'buttonhole') export const draftBarrelCuff = (part) => { - let { store, points, measurements, options, Point } = part.shorthand() - let height = measurements.shoulderToWrist * options.cuffLength - let width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap) + const { store, points, measurements, options, Point } = part.shorthand() + const height = measurements.shoulderToWrist * options.cuffLength + const width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap) store.set('cuffHeight', height) points.topLeft = new Point(0, 0) points.topRight = new Point(width, 0) @@ -55,7 +55,7 @@ export const draftBarrelCuff = (part) => { } export const decorateBarrelCuff = (part) => { - let { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand() + const { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand() // Title points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) macro('title', { @@ -66,7 +66,7 @@ export const decorateBarrelCuff = (part) => { }) // Button and buttonhole - let margin = measurements.wrist * options.cuffOverlap + const margin = measurements.wrist * options.cuffOverlap points.buttonLineTop = points.topRight.shift(180, margin / 2) points.buttonLineBottom = points.bottomRight.shift(180, margin / 2) points.buttonholeLineTop = points.topLeft.shift(0, margin / 2) @@ -93,10 +93,10 @@ export const decorateBarrelCuff = (part) => { } export const draftFrenchCuff = (part) => { - let { store, points, measurements, options, Point } = part.shorthand() - let margin = measurements.wrist * options.cuffOverlap - let height = measurements.shoulderToWrist * options.cuffLength - let width = + const { store, points, measurements, options, Point } = part.shorthand() + const margin = measurements.wrist * options.cuffOverlap + const height = measurements.shoulderToWrist * options.cuffLength + const width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap + options.cuffDrape) + margin / 2 store.set('cuffHeight', height) @@ -111,7 +111,7 @@ export const draftFrenchCuff = (part) => { } export const decorateFrenchCuff = (part) => { - let { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand() + const { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand() // Title points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) macro('title', { @@ -122,7 +122,7 @@ export const decorateFrenchCuff = (part) => { }) // Buttonholes - let margin = measurements.wrist * options.cuffOverlap + const margin = measurements.wrist * options.cuffOverlap points.buttonLineTop = points.topRight.shift(180, margin * 0.75) points.buttonLineBottom = points.bottomRight.shift(180, margin * 0.75) points.buttonholeLineTop = points.topLeft.shift(0, margin * 0.75) @@ -141,7 +141,7 @@ export const decorateFrenchCuff = (part) => { } export const paperlessBarrelCuff = (part) => { - let { sa, macro, points, options, complete } = part.shorthand() + const { sa, macro, points, options, complete } = part.shorthand() if (complete) { macro('hd', { from: points.buttonhole1, @@ -178,7 +178,7 @@ export const paperlessBarrelCuff = (part) => { } export const paperlessFrenchCuff = (part) => { - let { sa, macro, points, complete } = part.shorthand() + const { sa, macro, points, complete } = part.shorthand() if (complete) { macro('hd', { from: points.button4, @@ -206,8 +206,8 @@ export const paperlessFrenchCuff = (part) => { } export const frontDimensions = (part, side = 'left') => { - let { sa, options, paperless, points, macro } = part.shorthand() - let factor = side === 'right' ? -1 : 1 + const { sa, options, paperless, points, macro } = part.shorthand() + const factor = side === 'right' ? -1 : 1 macro('banner', { path: 'hemSa', text: ['hem', ': 3x', 'seamAllowance'], diff --git a/packages/simon/src/sleeve.js b/packages/simon/src/sleeve.js index 82cfc0bf0e8..0d3e0f3ee1e 100644 --- a/packages/simon/src/sleeve.js +++ b/packages/simon/src/sleeve.js @@ -1,5 +1,5 @@ export default (part) => { - let { + const { measurements, sa, Point, @@ -15,8 +15,8 @@ export default (part) => { } = part.shorthand() // Remove inherited paths, snippets, and scalebox - for (let p in paths) delete paths[p] - for (let s in snippets) delete snippets[s] + for (const p in paths) delete paths[p] + for (const s in snippets) delete snippets[s] macro('scalebox', false) // Sleeve width depends on cuff style @@ -29,7 +29,7 @@ export default (part) => { width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap * 1.5) points.wristRight.x = width / 2 points.wristLeft.x = width / -2 - let cuffLength = measurements.shoulderToWrist * options.cuffLength + const cuffLength = measurements.shoulderToWrist * options.cuffLength points.wristRight = points.wristRight.shift(90, cuffLength) points.wristLeft = points.wristLeft.shift(90, cuffLength) @@ -44,31 +44,31 @@ export default (part) => { points.cuffRightCuspCp2 = points.cuffRightCusp.shift(0, width / 10) // Cuff pleats - let drape = options.cuffDrape * measurements.shoulderToWrist + const drape = options.cuffDrape * measurements.shoulderToWrist let pleats = 0 - let pleatLength = measurements.shoulderToWrist * 0.15 + const pleatLength = measurements.shoulderToWrist * 0.15 if (drape > 0) { - let shiftRight = [ + const shiftRight = [ 'cuffRightCuspCp1', 'cuffRightCusp', 'cuffRightCuspCp2', 'wristRight', 'cuffRightMid', ] - let shiftLeft = ['cuffLeftCuspCp1', 'cuffLeftCusp', 'cuffLeftCuspCp2', 'wristLeft'] + const shiftLeft = ['cuffLeftCuspCp1', 'cuffLeftCusp', 'cuffLeftCuspCp2', 'wristLeft'] if (drape > 20) pleats = 2 else pleats = 1 - for (let id of shiftRight) points[id] = points[id].shift(0, drape / (2 * pleats)) - for (let id of shiftLeft) points[id] = points[id].shift(180, drape / (2 * pleats)) + for (const id of shiftRight) points[id] = points[id].shift(0, drape / (2 * pleats)) + for (const id of shiftLeft) points[id] = points[id].shift(180, drape / (2 * pleats)) points.cuffPleat1Fold = points.cuffMid.shift(0, drape / (2 * pleats)) points.cuffPleat1Edge = points.cuffMid.shift(0, drape / pleats) points.cuffMidTop = points.cuffMid.shift(90, pleatLength) points.cuffPleat1FoldTop = points.cuffPleat1Fold.shift(90, pleatLength) points.cuffPleat1EdgeTop = points.cuffPleat1Edge.shift(90, pleatLength) if (pleats === 2) { - let moreRight = ['cuffRightCuspCp2', 'wristRight'] - let shift = shiftRight.concat(shiftLeft) - for (let id of shift) { + const moreRight = ['cuffRightCuspCp2', 'wristRight'] + const shift = shiftRight.concat(shiftLeft) + for (const id of shift) { if (moreRight.indexOf(id) === -1) points[id] = points[id].shift(180, drape / 4) else points[id] = points[id].shift(0, drape / 4) } diff --git a/packages/simon/src/sleeveplacket-overlap.js b/packages/simon/src/sleeveplacket-overlap.js index 211e62539c7..b45c7f944f9 100644 --- a/packages/simon/src/sleeveplacket-overlap.js +++ b/packages/simon/src/sleeveplacket-overlap.js @@ -1,5 +1,5 @@ export default (part) => { - let { + const { measurements, sa, Point, @@ -12,10 +12,11 @@ export default (part) => { paperless, macro, options, + store } = part.shorthand() - let width = options.sleevePlacketWidth - let length = measurements.shoulderToWrist * options.sleevePlacketLength + const width = store.get('sleevePlacketWidth') + const length = measurements.shoulderToWrist * options.sleevePlacketLength points.midLeft = new Point(0, 0) points.midLen = points.midLeft.shift(0, length) diff --git a/packages/simon/src/sleeveplacket-underlap.js b/packages/simon/src/sleeveplacket-underlap.js index 01ce8f1f30a..39205ce71bb 100644 --- a/packages/simon/src/sleeveplacket-underlap.js +++ b/packages/simon/src/sleeveplacket-underlap.js @@ -1,5 +1,5 @@ export default (part) => { - let { + const { measurements, sa, Point, @@ -12,10 +12,11 @@ export default (part) => { paperless, macro, options, + store } = part.shorthand() - let width = options.sleevePlacketWidth > 20 ? 10 : options.sleevePlacketWidth / 4 - let length = measurements.shoulderToWrist * options.sleevePlacketLength + const width = store.get('sleevePlacketWidth') > 20 ? 10 : store.get('sleevePlacketWidth') / 4 + const length = measurements.shoulderToWrist * options.sleevePlacketLength points.midLeft = new Point(0, 0) points.midRight = points.midLeft.shift(0, length) diff --git a/packages/simon/src/yoke.js b/packages/simon/src/yoke.js index 9cef91d29ed..1209f186d27 100644 --- a/packages/simon/src/yoke.js +++ b/packages/simon/src/yoke.js @@ -1,8 +1,8 @@ export default (part) => { - let { sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options } = + const { sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options } = part.shorthand() - for (let id in paths) { + for (const id in paths) { if (['backCollar', 'backArmhole', 'backArmholeYoke'].indexOf(id) === -1) delete part.paths[id] }