1
0
Fork 0

fix(simon): Support drafting for non-human measurements

Closes #1319
This commit is contained in:
joostdecock 2021-09-12 15:29:59 +02:00
parent 569ddedef8
commit 3a283f5b7e
28 changed files with 130 additions and 117 deletions

View file

@ -192,14 +192,14 @@ export default {
collarStandCurve: { deg: 2, min: 0, max: 5 }, collarStandCurve: { deg: 2, min: 0, max: 5 },
collarFlare: { deg: 4, min: 0, max: 10 }, collarFlare: { deg: 4, min: 0, max: 10 },
// Millimeter // Used to be millimeter (now pct)
buttonPlacketWidth: { mm: 20, min: 10, max: 30 }, buttonPlacketWidth: { pct: 5, min: 2, max: 8 },
buttonholePlacketWidth: { mm: 35, min: 20, max: 45 }, buttonholePlacketWidth: { pct: 8, min: 4, max: 12 },
buttonholePlacketFoldWidth: { mm: 6, min: 3, max: 10 }, buttonholePlacketFoldWidth: { pct: 16, min: 8, max: 24 },
collarStandWidth: { mm: 35, min: 15, max: 60 }, collarStandWidth: { pct: 8, min: 3, max: 13 },
sleevePlacketWidth: { mm: 25, min: 15, max: 35 }, sleevePlacketWidth: { pct: 13, min: 8, max: 18 },
boxPleatWidth: { mm: 35, min: 5, max: 65 }, boxPleatWidth: { pct: 7, min: 4, max: 10 },
boxPleatFold: { mm: 5, min: 1, max: 15 }, boxPleatFold: { pct: 15, min: 10, max: 20 },
// Percentages // Percentages
acrossBackFactor: { pct: 97, min: 93, max: 100 }, acrossBackFactor: { pct: 97, min: 93, max: 100 },

View file

@ -1,7 +1,7 @@
import { calculateReduction } from './shared' import { calculateReduction } from './shared'
export default (part) => { export default (part) => {
let { const {
store, store,
measurements, measurements,
sa, sa,
@ -17,6 +17,15 @@ export default (part) => {
options, options,
} = part.shorthand() } = 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 // Populare store with data we need
calculateReduction(part) calculateReduction(part)
store.set( store.set(
@ -28,6 +37,7 @@ export default (part) => {
.join(paths.backArmhole) .join(paths.backArmhole)
.length() .length()
) )
// Hip shaping // Hip shaping
points.hips = points.hips.shift(180, store.get('hipsReduction') / 4) points.hips = points.hips.shift(180, store.get('hipsReduction') / 4)
points.hem = points.hem.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 // Box pleat
if (options.boxPleat) { if (options.boxPleat) {
points.boxPleatLeft = paths.roundedBack points.boxPleatLeft = paths.roundedBack
? points.cbTop.shift(0, options.boxPleatWidth / 2) ? points.cbTop.shift(0, store.get('boxPleatWidth') / 2)
: points.cbYoke.shift(0, options.boxPleatWidth / 2) : points.cbYoke.shift(0, store.get('boxPleatWidth') / 2)
points.boxPleatMid = points.boxPleatLeft.shift(0, options.boxPleatFold) points.boxPleatMid = points.boxPleatLeft.shift(0, store.get('boxPleatFold'))
points.boxPleatRight = points.boxPleatMid.shift(0, options.boxPleatFold) points.boxPleatRight = points.boxPleatMid.shift(0, store.get('boxPleatFold'))
points.boxPleatLeftBottom = new Point(points.boxPleatLeft.x, points.armholeHollowCp2.y) points.boxPleatLeftBottom = new Point(points.boxPleatLeft.x, points.armholeHollowCp2.y)
points.boxPleatMidBottom = new Point(points.boxPleatMid.x, points.armholeHollowCp2.y) points.boxPleatMidBottom = new Point(points.boxPleatMid.x, points.armholeHollowCp2.y)
points.boxPleatRightBottom = new Point(points.boxPleatRight.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.setRender(true).attr('class', 'stroke-xl highlight debug canvas')
paths.armhole = paths.armhole.translate(options.boxPleatFold * 2, 0) paths.armhole = paths.armhole.translate(store.get('boxPleatFold') * 2, 0)
for (let p of [ for (const p of [
'armholePitch', 'armholePitch',
'armholePitchCp1', 'armholePitchCp1',
'armholeHollowCp2', 'armholeHollowCp2',
@ -141,7 +151,7 @@ export default (part) => {
'armhole', 'armhole',
'armholeYokeSplit', 'armholeYokeSplit',
]) ])
points[p] = points[p].shift(0, options.boxPleatFold * 2) points[p] = points[p].shift(0, store.get('boxPleatFold') * 2)
} }
// Draft hem // Draft hem

View file

@ -1,7 +1,7 @@
import { addButtonHoles } from './shared' import { addButtonHoles } from './shared'
export default (part) => { export default (part) => {
let { const {
utils, utils,
sa, sa,
Point, Point,
@ -23,9 +23,9 @@ export default (part) => {
return part return part
} }
for (let id in paths) delete part.paths[id] for (const id in paths) delete part.paths[id]
let width = options.buttonholePlacketWidth const width = store.get('buttonholePlacketWidth')
let fold = options.buttonholePlacketFoldWidth const fold = store.get('buttonholePlacketFoldWidth')
points.topInnerEdge = utils.lineIntersectsCurve( points.topInnerEdge = utils.lineIntersectsCurve(
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20), new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20),
@ -140,7 +140,7 @@ export default (part) => {
// Paperless? // Paperless?
if (paperless) { if (paperless) {
let offset = 0 let offset = 0
for (let pid of [ for (const pid of [
'placketBottomOuterEdgeUnder', 'placketBottomOuterEdgeUnder',
'placketBottomOuterEdgeFold', 'placketBottomOuterEdgeFold',
'placketBottomOuterEdgeOver', 'placketBottomOuterEdgeOver',

View file

@ -1,7 +1,7 @@
import { addButtons } from './shared' import { addButtons } from './shared'
export default (part) => { export default (part) => {
let { const {
utils, utils,
sa, sa,
Point, Point,
@ -23,11 +23,11 @@ export default (part) => {
return part return part
} }
for (let id in paths) { for (const id in paths) {
if (id !== 'seam') delete part.paths[id] if (id !== 'seam') delete part.paths[id]
} }
macro('flip') macro('flip')
let width = options.buttonPlacketWidth const width = store.get('buttonPlacketWidth')
points.placketTopIn = utils.lineIntersectsCurve( points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20), new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20), new Point(width / -2, points.cfNeck.y - 20),

View file

@ -1,10 +1,10 @@
export default (part) => { 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() part.shorthand()
const draft = function (tweak = 1) { const draft = function (tweak = 1) {
let length = measurements.neck * (1 + options.collarEase - options.collarGap) * tweak const length = measurements.neck * (1 + options.collarEase - options.collarGap) * tweak
let width = options.collarStandWidth * (1 + options.collarRoll) const width = store.get('collarStandWidth') * (1 + options.collarRoll)
// Draft right side // Draft right side
points.topMid = new Point(0, 0) points.topMid = new Point(0, 0)
@ -62,7 +62,7 @@ export default (part) => {
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {
// Draw undercollar line // 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.ucTopMid = points.topMid.shift(-90, uc)
points.ucRightTopHinge = points.rightTopHinge.shift(-90, uc) points.ucRightTopHinge = points.rightTopHinge.shift(-90, uc)
points.ucRightTopHingeCp1 = points.rightTopHingeCp1.shift(-90, uc) points.ucRightTopHingeCp1 = points.rightTopHingeCp1.shift(-90, uc)

View file

@ -1,6 +1,7 @@
export default (part) => { export default (part) => {
let { const {
measurements, measurements,
store,
sa, sa,
Point, Point,
points, points,
@ -15,12 +16,12 @@ export default (part) => {
} = part.shorthand() } = part.shorthand()
const draft = function (tweak = 1) { const draft = function (tweak = 1) {
let length = measurements.neck * (1 + options.collarEase) * tweak const length = measurements.neck * (1 + options.collarEase) * tweak
let width = options.collarStandWidth const width = store.get('collarStandWidth')
let half = length / 2 const half = length / 2
let bend = options.collarStandBend * -1 const bend = options.collarStandBend * -1
let curve = options.collarStandCurve - options.collarStandBend const curve = options.collarStandCurve - options.collarStandBend
let hinge = 90 + (bend + curve) / 2 const hinge = 90 + (bend + curve) / 2
// Center line // Center line
points.center = new Point(0, 0) points.center = new Point(0, 0)
@ -34,7 +35,7 @@ export default (part) => {
points.rightBottomHinge = points.hinge.shift(180 + hinge, width / 2) points.rightBottomHinge = points.hinge.shift(180 + hinge, width / 2)
points.rightTopCf = points.rightCf.shift(curve + 90, width / 2) points.rightTopCf = points.rightCf.shift(curve + 90, width / 2)
points.rightBottomCf = 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) // Add control points (right side only)
points.bottomMidCp2 = points.bottomMid.shift(0, half * 0.2) 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.rightBottomHingeCp2 = points.rightBottomHinge.shift(hinge - 90, half * 0.1)
points.rightBottomCfCp1 = points.rightBottomCf.shift(180 + curve, half * 0.1) points.rightBottomCfCp1 = points.rightBottomCf.shift(180 + curve, half * 0.1)
points.rightBottomEdgeCp2 = points.rightBottomCf.rotate(-90, points.rightBottomEdge) 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.topMidCp1 = points.topMid.shift(0, half * 0.2)
points.rightTopHingeCp2 = points.rightTopHinge.shift(90 + hinge, half * 0.2) points.rightTopHingeCp2 = points.rightTopHinge.shift(90 + hinge, half * 0.2)
points.rightTopHingeCp1 = points.rightTopHinge.shift(hinge - 90, half * 0.1) points.rightTopHingeCp1 = points.rightTopHinge.shift(hinge - 90, half * 0.1)
points.topEdgeCp1 = points.rightTopCf.rotate(-90, points.rightBottomEdge) 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 // Now do the left side
points.leftCf = points.rightCf.flipX() points.leftCf = points.rightCf.flipX()
@ -58,8 +59,8 @@ export default (part) => {
points.leftTopCfCp1 = points.rightTopCfCp2.flipX() points.leftTopCfCp1 = points.rightTopCfCp2.flipX()
points.leftTopCf = points.rightTopCf.flipX() points.leftTopCf = points.rightTopCf.flipX()
points.leftBottomCf = points.rightBottomCf.flipX() points.leftBottomCf = points.rightBottomCf.flipX()
points.leftBottomEdge = points.leftBottomCf.shift(bend + 180, options.buttonPlacketWidth / 2) points.leftBottomEdge = points.leftBottomCf.shift(bend + 180, store.get('buttonPlacketWidth') / 2)
points.leftTopCfCp2 = points.leftTopCf.shift(bend + 180, options.buttonPlacketWidth / 2) points.leftTopCfCp2 = points.leftTopCf.shift(bend + 180, store.get('buttonPlacketWidth') / 2)
points.leftBottomEdgeCp1 = points.leftBottomCf.rotate(90, points.leftBottomEdge) points.leftBottomEdgeCp1 = points.leftBottomCf.rotate(90, points.leftBottomEdge)
points.leftBottomCfCp2 = points.rightBottomCfCp1.flipX() points.leftBottomCfCp2 = points.rightBottomCfCp1.flipX()
points.leftBottomHingeCp1 = points.rightBottomHingeCp2.flipX() points.leftBottomHingeCp1 = points.rightBottomHingeCp2.flipX()
@ -144,7 +145,7 @@ export default (part) => {
// Button and buttonhole // Button and buttonhole
snippets.button = new Snippet('button', points.leftCf) 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) points.buttonhole = points.rightCf.shift(angle, 3)
snippets.buttonhole = new Snippet('buttonhole', points.buttonhole).attr( snippets.buttonhole = new Snippet('buttonhole', points.buttonhole).attr(
'data-rotate', 'data-rotate',
@ -200,7 +201,7 @@ export default (part) => {
macro('ld', { macro('ld', {
from: points.rightBottomCf, from: points.rightBottomCf,
to: points.rightTopCf, to: points.rightTopCf,
d: -15 - sa - options.buttonholePlacketWidth / 2, d: -15 - sa - store.get('buttonholePlacketWidth') / 2,
}) })
macro('vd', { macro('vd', {
from: points.rightBottomCf, from: points.rightBottomCf,

View file

@ -1,10 +1,10 @@
import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared' import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared'
export default (part) => { 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) draftBarrelCuff(part)
let height = store.get('cuffHeight') const height = store.get('cuffHeight')
points.leftAngleTop = points.topLeft.shift(0, height / 3) points.leftAngleTop = points.topLeft.shift(0, height / 3)
points.leftAngleBottom = points.topLeft.shift(-90, height / 3) points.leftAngleBottom = points.topLeft.shift(-90, height / 3)

View file

@ -4,7 +4,7 @@ export default (part) => {
let { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand() let { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand()
draftBarrelCuff(part) draftBarrelCuff(part)
let height = store.get('cuffHeight') const height = store.get('cuffHeight')
macro('round', { macro('round', {
from: points.topRight, from: points.topRight,
to: points.bottomLeft, to: points.bottomLeft,

View file

@ -1,7 +1,7 @@
import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared' import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared'
export default (part) => { export default (part) => {
let { sa, points, Path, paths, complete, paperless } = part.shorthand() const { sa, points, Path, paths, complete, paperless } = part.shorthand()
draftBarrelCuff(part) draftBarrelCuff(part)
paths.seam = new Path() paths.seam = new Path()

View file

@ -1,10 +1,10 @@
import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared' import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared'
export default (part) => { 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) draftFrenchCuff(part)
let height = store.get('cuffHeight') const height = store.get('cuffHeight')
points.leftAngleTopTop = points.topLeft.shift(0, height / 3) points.leftAngleTopTop = points.topLeft.shift(0, height / 3)
points.leftAngleTopBottom = points.topLeft.shift(-90, height / 3) points.leftAngleTopBottom = points.topLeft.shift(-90, height / 3)
points.rightAngleTopTop = points.topRight.shift(180, height / 3) points.rightAngleTopTop = points.topRight.shift(180, height / 3)

View file

@ -1,9 +1,9 @@
import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared' import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared'
export default (part) => { 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) draftFrenchCuff(part)
let height = store.get('cuffHeight') const height = store.get('cuffHeight')
macro('round', { macro('round', {
from: points.topRight, from: points.topRight,
to: points.bottomLeft, to: points.bottomLeft,

View file

@ -1,7 +1,7 @@
import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared' import { draftFrenchCuff, decorateFrenchCuff, paperlessFrenchCuff } from './shared'
export default (part) => { export default (part) => {
let { sa, points, Path, paths, complete, paperless } = part.shorthand() const { sa, points, Path, paths, complete, paperless } = part.shorthand()
draftFrenchCuff(part) draftFrenchCuff(part)

View file

@ -6,7 +6,7 @@ import angledFrenchCuff from './cuff-french-angled'
import roundedFrenchCuff from './cuff-french-rounded' import roundedFrenchCuff from './cuff-french-rounded'
export default (part) => { export default (part) => {
let { options } = part.shorthand() const { options } = part.shorthand()
switch (options.cuffStyle) { switch (options.cuffStyle) {
case 'roundedBarrelCuff': case 'roundedBarrelCuff':
return roundedBarrelCuff(part) return roundedBarrelCuff(part)

View file

@ -1,14 +1,14 @@
import { calculateReduction } from './shared' import { calculateReduction } from './shared'
export default (part) => { 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() part.shorthand()
// Clean up // Clean up
for (let i in paths) { for (const i in paths) {
if (['frontArmhole', 'frontCollar'].indexOf(i) === -1) delete paths[i] 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] if (i.indexOf('otch')) delete snippets[i]
} }

View file

@ -1,11 +1,11 @@
import { addButtonHoles } from './shared' import { addButtonHoles } from './shared'
export default (part) => { 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() part.shorthand()
let fold = options.buttonholePlacketFoldWidth const fold = store.get('buttonholePlacketFoldWidth')
let width = options.buttonholePlacketWidth const width = store.get('buttonholePlacketWidth')
points.placketCfNeck = points.cfNeck.shift(180, fold * 2) points.placketCfNeck = points.cfNeck.shift(180, fold * 2)
points.placketTopInnerEdgeFold = points.placketCfNeck.shift(0, width / 2) points.placketTopInnerEdgeFold = points.placketCfNeck.shift(0, width / 2)
points.placketTopInnerEdgeOver = points.placketCfNeck.shift(0, width / 2 - fold) points.placketTopInnerEdgeOver = points.placketCfNeck.shift(0, width / 2 - fold)
@ -117,7 +117,7 @@ export default (part) => {
to: points.hips, to: points.hips,
}) })
let offset = 0 let offset = 0
for (let pid of [ for (const pid of [
'placketTopOuterEdgeUnder', 'placketTopOuterEdgeUnder',
'placketTopOuterEdgeFold', 'placketTopOuterEdgeFold',
'placketTopOuterEdgeOver', 'placketTopOuterEdgeOver',

View file

@ -1,8 +1,8 @@
export default (part) => { 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() part.shorthand()
let fold = options.buttonholePlacketFoldWidth const fold = store.get('buttonholePlacketFoldWidth')
points.neckEdge = utils.lineIntersectsCurve( 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),
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, to: points.s3CollarSplit,
x: points.neckEdge.x - sa - 30, x: points.neckEdge.x - sa - 30,
}) })
for (let pid of ['Armhole', 'Waist', 'Hips']) { for (const pid of ['Armhole', 'Waist', 'Hips']) {
macro('hd', { macro('hd', {
from: points['edge' + pid], from: points['edge' + pid],
to: points[pid.toLowerCase()], to: points[pid.toLowerCase()],

View file

@ -1,8 +1,8 @@
import { addButtonHoles } from './shared' import { addButtonHoles } from './shared'
export default (part) => { export default (part) => {
let { sa, points, Path, paths, complete, paperless, macro, options } = part.shorthand() const { sa, points, Path, paths, complete, paperless, store, macro, options } = part.shorthand()
let width = options.buttonholePlacketWidth const width = store.get('buttonholePlacketWidth')
points.placketCfNeck = points.cfNeck points.placketCfNeck = points.cfNeck
points.placketTopFold1 = points.cfNeck.shift(180, width / 2) points.placketTopFold1 = points.cfNeck.shift(180, width / 2)
points.placketTopFold2 = points.cfNeck.shift(180, width * 1.5) points.placketTopFold2 = points.cfNeck.shift(180, width * 1.5)
@ -58,7 +58,7 @@ export default (part) => {
// Paperless? // Paperless?
if (paperless) { if (paperless) {
let offset = 0 let offset = 0
for (let pid of ['placketBottomFold2', 'placketBottomFold1', 'cfHem', 'hips']) { for (const pid of ['placketBottomFold2', 'placketBottomFold1', 'cfHem', 'hips']) {
offset += 15 offset += 15
macro('hd', { macro('hd', {
from: points.placketBottomEdge, from: points.placketBottomEdge,

View file

@ -4,7 +4,7 @@ import frontLeftClassicCuton from './frontleft-classic-cuton'
import frontLeftSeamless from './frontleft-seamless' import frontLeftSeamless from './frontleft-seamless'
export default (part) => { export default (part) => {
let { sa, options, complete, paperless, points, macro } = part.shorthand() const { sa, options, complete, paperless, points, macro } = part.shorthand()
if (complete && paperless) { if (complete && paperless) {
frontDimensions(part, 'left') frontDimensions(part, 'left')

View file

@ -1,10 +1,10 @@
import { addButtons } from './shared' import { addButtons } from './shared'
export default (part) => { 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() part.shorthand()
let width = options.buttonPlacketWidth const width = store.get('buttonPlacketWidth')
points.placketTopIn = utils.lineIntersectsCurve( points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20), new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20), new Point(width / -2, points.cfNeck.y - 20),

View file

@ -1,8 +1,8 @@
export default (part) => { 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() part.shorthand()
let width = options.buttonPlacketWidth const width = store.get('buttonPlacketWidth')
points.placketTopIn = utils.lineIntersectsCurve( points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20), new Point(width / -2, points.cfNeck.y + 20),
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, to: points.placketTopIn,
x: points.placketTopIn.x + sa + 15, x: points.placketTopIn.x + sa + 15,
}) })
for (let pid of ['Armhole', 'Waist', 'Hips']) { for (const pid of ['Armhole', 'Waist', 'Hips']) {
macro('hd', { macro('hd', {
from: points['edge' + pid], from: points['edge' + pid],
to: points[pid.toLowerCase()], to: points[pid.toLowerCase()],

View file

@ -1,9 +1,9 @@
import { addButtons } from './shared' import { addButtons } from './shared'
export default (part) => { 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.placketTopFold1 = points.cfNeck.shift(0, width / 2)
points.placketTopFold2 = points.cfNeck.shift(0, width * 1.5) points.placketTopFold2 = points.cfNeck.shift(0, width * 1.5)
points.placketTopEdge = points.cfNeck.shift(0, width * 2.5) points.placketTopEdge = points.cfNeck.shift(0, width * 2.5)

View file

@ -4,7 +4,7 @@ import frontRightClassicCuton from './frontright-classic-cuton'
import frontRightSeamless from './frontright-seamless' import frontRightSeamless from './frontright-seamless'
export default (part) => { 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') macro('flip')
if (complete) { if (complete) {
points.scalebox = points.waist.shiftFractionTowards(points.cfWaist, 0.5) points.scalebox = points.waist.shiftFractionTowards(points.cfWaist, 0.5)

View file

@ -33,7 +33,7 @@ Pattern.prototype.draftBackBase = function (part) {
return new Brian(this.settings).draftBack(part) return new Brian(this.settings).draftBack(part)
} }
Pattern.prototype.draftSleeveBase = function (part) { Pattern.prototype.draftSleeveBase = function (part) {
let brian = new Brian(this.settings) const brian = new Brian(this.settings)
return brian.draftSleeve(brian.draftSleevecap(part)) return brian.draftSleeve(brian.draftSleevecap(part))
} }
Pattern.prototype.draftBack = draftBack Pattern.prototype.draftBack = draftBack

View file

@ -1,8 +1,8 @@
export const calculateReduction = function (part) { export const calculateReduction = function (part) {
let { store, measurements, options } = part.shorthand() const { store, measurements, options } = part.shorthand()
let chest = measurements.chest * (1 + options.chestEase) const chest = measurements.chest * (1 + options.chestEase)
let waist = measurements.waist * (1 + options.waistEase) const waist = measurements.waist * (1 + options.waistEase)
let hips = measurements.hips * (1 + options.hipsEase) const hips = measurements.hips * (1 + options.hipsEase)
let waistReduction = chest - waist let waistReduction = chest - waist
let hipsReduction = chest - hips let hipsReduction = chest - hips
@ -26,8 +26,8 @@ export const calculateReduction = function (part) {
} }
export const addButtons = function (part, origin = 'cfNeck', snippet = 'button') { export const addButtons = function (part, origin = 'cfNeck', snippet = 'button') {
let { points, options, snippets, Snippet } = part.shorthand() const { points, options, snippets, Snippet } = part.shorthand()
let len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength) const len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength)
for (let i = 1; i <= options.buttons; i++) { for (let i = 1; i <= options.buttons; i++) {
points['button' + i] = points[origin].shift(-90, (len / options.buttons) * i) points['button' + i] = points[origin].shift(-90, (len / options.buttons) * i)
snippets[snippet + i] = new Snippet(snippet, points['button' + 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 addButtonHoles = (part, origin) => addButtons(part, origin, 'buttonhole')
export const draftBarrelCuff = (part) => { export const draftBarrelCuff = (part) => {
let { store, points, measurements, options, Point } = part.shorthand() const { store, points, measurements, options, Point } = part.shorthand()
let height = measurements.shoulderToWrist * options.cuffLength const height = measurements.shoulderToWrist * options.cuffLength
let width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap) const width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap)
store.set('cuffHeight', height) store.set('cuffHeight', height)
points.topLeft = new Point(0, 0) points.topLeft = new Point(0, 0)
points.topRight = new Point(width, 0) points.topRight = new Point(width, 0)
@ -55,7 +55,7 @@ export const draftBarrelCuff = (part) => {
} }
export const decorateBarrelCuff = (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 // Title
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
macro('title', { macro('title', {
@ -66,7 +66,7 @@ export const decorateBarrelCuff = (part) => {
}) })
// Button and buttonhole // Button and buttonhole
let margin = measurements.wrist * options.cuffOverlap const margin = measurements.wrist * options.cuffOverlap
points.buttonLineTop = points.topRight.shift(180, margin / 2) points.buttonLineTop = points.topRight.shift(180, margin / 2)
points.buttonLineBottom = points.bottomRight.shift(180, margin / 2) points.buttonLineBottom = points.bottomRight.shift(180, margin / 2)
points.buttonholeLineTop = points.topLeft.shift(0, margin / 2) points.buttonholeLineTop = points.topLeft.shift(0, margin / 2)
@ -93,10 +93,10 @@ export const decorateBarrelCuff = (part) => {
} }
export const draftFrenchCuff = (part) => { export const draftFrenchCuff = (part) => {
let { store, points, measurements, options, Point } = part.shorthand() const { store, points, measurements, options, Point } = part.shorthand()
let margin = measurements.wrist * options.cuffOverlap const margin = measurements.wrist * options.cuffOverlap
let height = measurements.shoulderToWrist * options.cuffLength const height = measurements.shoulderToWrist * options.cuffLength
let width = const width =
measurements.wrist * (1 + options.cuffEase + options.cuffOverlap + options.cuffDrape) + measurements.wrist * (1 + options.cuffEase + options.cuffOverlap + options.cuffDrape) +
margin / 2 margin / 2
store.set('cuffHeight', height) store.set('cuffHeight', height)
@ -111,7 +111,7 @@ export const draftFrenchCuff = (part) => {
} }
export const decorateFrenchCuff = (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 // Title
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
macro('title', { macro('title', {
@ -122,7 +122,7 @@ export const decorateFrenchCuff = (part) => {
}) })
// Buttonholes // Buttonholes
let margin = measurements.wrist * options.cuffOverlap const margin = measurements.wrist * options.cuffOverlap
points.buttonLineTop = points.topRight.shift(180, margin * 0.75) points.buttonLineTop = points.topRight.shift(180, margin * 0.75)
points.buttonLineBottom = points.bottomRight.shift(180, margin * 0.75) points.buttonLineBottom = points.bottomRight.shift(180, margin * 0.75)
points.buttonholeLineTop = points.topLeft.shift(0, margin * 0.75) points.buttonholeLineTop = points.topLeft.shift(0, margin * 0.75)
@ -141,7 +141,7 @@ export const decorateFrenchCuff = (part) => {
} }
export const paperlessBarrelCuff = (part) => { export const paperlessBarrelCuff = (part) => {
let { sa, macro, points, options, complete } = part.shorthand() const { sa, macro, points, options, complete } = part.shorthand()
if (complete) { if (complete) {
macro('hd', { macro('hd', {
from: points.buttonhole1, from: points.buttonhole1,
@ -178,7 +178,7 @@ export const paperlessBarrelCuff = (part) => {
} }
export const paperlessFrenchCuff = (part) => { export const paperlessFrenchCuff = (part) => {
let { sa, macro, points, complete } = part.shorthand() const { sa, macro, points, complete } = part.shorthand()
if (complete) { if (complete) {
macro('hd', { macro('hd', {
from: points.button4, from: points.button4,
@ -206,8 +206,8 @@ export const paperlessFrenchCuff = (part) => {
} }
export const frontDimensions = (part, side = 'left') => { export const frontDimensions = (part, side = 'left') => {
let { sa, options, paperless, points, macro } = part.shorthand() const { sa, options, paperless, points, macro } = part.shorthand()
let factor = side === 'right' ? -1 : 1 const factor = side === 'right' ? -1 : 1
macro('banner', { macro('banner', {
path: 'hemSa', path: 'hemSa',
text: ['hem', ': 3x', 'seamAllowance'], text: ['hem', ': 3x', 'seamAllowance'],

View file

@ -1,5 +1,5 @@
export default (part) => { export default (part) => {
let { const {
measurements, measurements,
sa, sa,
Point, Point,
@ -15,8 +15,8 @@ export default (part) => {
} = part.shorthand() } = part.shorthand()
// Remove inherited paths, snippets, and scalebox // Remove inherited paths, snippets, and scalebox
for (let p in paths) delete paths[p] for (const p in paths) delete paths[p]
for (let s in snippets) delete snippets[s] for (const s in snippets) delete snippets[s]
macro('scalebox', false) macro('scalebox', false)
// Sleeve width depends on cuff style // Sleeve width depends on cuff style
@ -29,7 +29,7 @@ export default (part) => {
width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap * 1.5) width = measurements.wrist * (1 + options.cuffEase + options.cuffOverlap * 1.5)
points.wristRight.x = width / 2 points.wristRight.x = width / 2
points.wristLeft.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.wristRight = points.wristRight.shift(90, cuffLength)
points.wristLeft = points.wristLeft.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) points.cuffRightCuspCp2 = points.cuffRightCusp.shift(0, width / 10)
// Cuff pleats // Cuff pleats
let drape = options.cuffDrape * measurements.shoulderToWrist const drape = options.cuffDrape * measurements.shoulderToWrist
let pleats = 0 let pleats = 0
let pleatLength = measurements.shoulderToWrist * 0.15 const pleatLength = measurements.shoulderToWrist * 0.15
if (drape > 0) { if (drape > 0) {
let shiftRight = [ const shiftRight = [
'cuffRightCuspCp1', 'cuffRightCuspCp1',
'cuffRightCusp', 'cuffRightCusp',
'cuffRightCuspCp2', 'cuffRightCuspCp2',
'wristRight', 'wristRight',
'cuffRightMid', 'cuffRightMid',
] ]
let shiftLeft = ['cuffLeftCuspCp1', 'cuffLeftCusp', 'cuffLeftCuspCp2', 'wristLeft'] const shiftLeft = ['cuffLeftCuspCp1', 'cuffLeftCusp', 'cuffLeftCuspCp2', 'wristLeft']
if (drape > 20) pleats = 2 if (drape > 20) pleats = 2
else pleats = 1 else pleats = 1
for (let id of shiftRight) points[id] = points[id].shift(0, drape / (2 * pleats)) for (const 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 shiftLeft) points[id] = points[id].shift(180, drape / (2 * pleats))
points.cuffPleat1Fold = points.cuffMid.shift(0, drape / (2 * pleats)) points.cuffPleat1Fold = points.cuffMid.shift(0, drape / (2 * pleats))
points.cuffPleat1Edge = points.cuffMid.shift(0, drape / pleats) points.cuffPleat1Edge = points.cuffMid.shift(0, drape / pleats)
points.cuffMidTop = points.cuffMid.shift(90, pleatLength) points.cuffMidTop = points.cuffMid.shift(90, pleatLength)
points.cuffPleat1FoldTop = points.cuffPleat1Fold.shift(90, pleatLength) points.cuffPleat1FoldTop = points.cuffPleat1Fold.shift(90, pleatLength)
points.cuffPleat1EdgeTop = points.cuffPleat1Edge.shift(90, pleatLength) points.cuffPleat1EdgeTop = points.cuffPleat1Edge.shift(90, pleatLength)
if (pleats === 2) { if (pleats === 2) {
let moreRight = ['cuffRightCuspCp2', 'wristRight'] const moreRight = ['cuffRightCuspCp2', 'wristRight']
let shift = shiftRight.concat(shiftLeft) const shift = shiftRight.concat(shiftLeft)
for (let id of shift) { for (const id of shift) {
if (moreRight.indexOf(id) === -1) points[id] = points[id].shift(180, drape / 4) if (moreRight.indexOf(id) === -1) points[id] = points[id].shift(180, drape / 4)
else points[id] = points[id].shift(0, drape / 4) else points[id] = points[id].shift(0, drape / 4)
} }

View file

@ -1,5 +1,5 @@
export default (part) => { export default (part) => {
let { const {
measurements, measurements,
sa, sa,
Point, Point,
@ -12,10 +12,11 @@ export default (part) => {
paperless, paperless,
macro, macro,
options, options,
store
} = part.shorthand() } = part.shorthand()
let width = options.sleevePlacketWidth const width = store.get('sleevePlacketWidth')
let length = measurements.shoulderToWrist * options.sleevePlacketLength const length = measurements.shoulderToWrist * options.sleevePlacketLength
points.midLeft = new Point(0, 0) points.midLeft = new Point(0, 0)
points.midLen = points.midLeft.shift(0, length) points.midLen = points.midLeft.shift(0, length)

View file

@ -1,5 +1,5 @@
export default (part) => { export default (part) => {
let { const {
measurements, measurements,
sa, sa,
Point, Point,
@ -12,10 +12,11 @@ export default (part) => {
paperless, paperless,
macro, macro,
options, options,
store
} = part.shorthand() } = part.shorthand()
let width = options.sleevePlacketWidth > 20 ? 10 : options.sleevePlacketWidth / 4 const width = store.get('sleevePlacketWidth') > 20 ? 10 : store.get('sleevePlacketWidth') / 4
let length = measurements.shoulderToWrist * options.sleevePlacketLength const length = measurements.shoulderToWrist * options.sleevePlacketLength
points.midLeft = new Point(0, 0) points.midLeft = new Point(0, 0)
points.midRight = points.midLeft.shift(0, length) points.midRight = points.midLeft.shift(0, length)

View file

@ -1,8 +1,8 @@
export default (part) => { 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() part.shorthand()
for (let id in paths) { for (const id in paths) {
if (['backCollar', 'backArmhole', 'backArmholeYoke'].indexOf(id) === -1) delete part.paths[id] if (['backCollar', 'backArmhole', 'backArmholeYoke'].indexOf(id) === -1) delete part.paths[id]
} }