2022-08-28 15:23:10 +02:00
|
|
|
import { dimensions } from './shared.mjs'
|
2022-09-10 20:26:11 +02:00
|
|
|
import { front } from './front.mjs'
|
2018-08-11 16:42:35 +02:00
|
|
|
|
2022-08-28 15:23:10 +02:00
|
|
|
export const back = {
|
2022-08-09 20:17:35 +02:00
|
|
|
from: front,
|
2022-08-28 16:26:28 +02:00
|
|
|
name: 'aaron.back',
|
2022-08-28 15:23:10 +02:00
|
|
|
options: {
|
|
|
|
backNeckCutout: 0.05,
|
2022-09-10 20:26:11 +02:00
|
|
|
backlineBend: { pct: 50, min: 25, max: 100, menu: 'style' },
|
2023-09-10 10:56:41 +02:00
|
|
|
knitBindingWidth: { pct: 600, min: 300, max: 800, menu: 'style' },
|
2023-10-08 14:29:45 +02:00
|
|
|
// Hide options from brian
|
|
|
|
brianFitSleeve: false,
|
|
|
|
cuffEase: 0,
|
|
|
|
s3Collar: 0,
|
|
|
|
s3Armhole: 0,
|
2022-08-28 15:23:10 +02:00
|
|
|
},
|
2022-09-10 19:39:45 +02:00
|
|
|
draft: ({
|
|
|
|
store,
|
|
|
|
sa,
|
|
|
|
Point,
|
|
|
|
points,
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
options,
|
|
|
|
complete,
|
2023-09-06 10:59:45 +02:00
|
|
|
expand,
|
2022-09-10 19:39:45 +02:00
|
|
|
macro,
|
|
|
|
utils,
|
|
|
|
units,
|
|
|
|
measurements,
|
|
|
|
part,
|
|
|
|
}) => {
|
2022-08-09 20:17:35 +02:00
|
|
|
// Lower back neck a bit
|
|
|
|
points.cbNeck.y = measurements.neck / 10
|
2020-05-24 16:21:26 +02:00
|
|
|
|
2022-08-09 20:17:35 +02:00
|
|
|
points.strapLeftCp2 = utils.beamsIntersect(
|
|
|
|
points.strapLeft,
|
|
|
|
points.strapCenter.rotate(90, points.strapLeft),
|
|
|
|
points.cbNeck,
|
|
|
|
points.cbNeck.shift(0, 10)
|
|
|
|
)
|
2018-08-27 14:12:14 +02:00
|
|
|
|
2022-08-09 20:17:35 +02:00
|
|
|
points.armholeCp2 = points.armhole.shiftFractionTowards(
|
|
|
|
points.armholeCorner,
|
|
|
|
options.backlineBend
|
|
|
|
)
|
|
|
|
points.strapRightCp1 = points.strapRight.shiftFractionTowards(
|
|
|
|
points.armholeCorner,
|
|
|
|
options.backlineBend
|
|
|
|
)
|
2018-08-27 14:12:14 +02:00
|
|
|
|
2022-08-09 20:17:35 +02:00
|
|
|
points.anchor = points.cbNeck.clone()
|
2020-06-01 14:52:31 +02:00
|
|
|
|
2022-08-09 20:17:35 +02:00
|
|
|
// Seamline
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.cbNeck)
|
|
|
|
.line(points.cbHem)
|
|
|
|
.line(points.hem)
|
|
|
|
.curve_(points.hipsCp2, points.armhole)
|
|
|
|
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
|
|
|
|
.line(points.strapLeft)
|
|
|
|
.line(points.strapLeft)
|
|
|
|
.curve(points.strapLeftCp2, points.cbNeck, points.cbNeck)
|
|
|
|
.close()
|
|
|
|
.attr('class', 'fabric')
|
2018-08-27 14:12:14 +02:00
|
|
|
|
2023-09-06 10:59:45 +02:00
|
|
|
/*
|
|
|
|
* Annotations
|
|
|
|
*/
|
2023-09-07 19:51:52 +02:00
|
|
|
|
|
|
|
// Set anchor point for grid
|
|
|
|
points.gridAnchor = points.cfHem
|
|
|
|
|
2023-09-06 10:59:45 +02:00
|
|
|
// cutonfold
|
|
|
|
macro('cutonfold', {
|
|
|
|
from: points.cfNeck,
|
|
|
|
to: points.cfHem,
|
|
|
|
grainline: true,
|
|
|
|
})
|
|
|
|
|
|
|
|
// title
|
|
|
|
macro('title', { at: points.title, nr: 2, title: 'back' })
|
|
|
|
points.scaleboxAnchor = points.scalebox = points.title.shift(90, 100)
|
|
|
|
|
|
|
|
// scalebox
|
|
|
|
macro('scalebox', { at: points.scalebox })
|
|
|
|
|
|
|
|
// Store length of binding in the store
|
2023-09-10 10:56:41 +02:00
|
|
|
store.set('bindingWidth', (sa || 10) * options.knitBindingWidth)
|
2023-09-06 10:59:45 +02:00
|
|
|
store.set(
|
|
|
|
'armBindingLength',
|
|
|
|
(new Path()
|
|
|
|
.move(points.armhole)
|
|
|
|
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
|
|
|
|
.length() +
|
|
|
|
store.get('frontArmholeLength')) *
|
2023-10-01 19:07:34 +02:00
|
|
|
0.95
|
2023-09-06 10:59:45 +02:00
|
|
|
)
|
|
|
|
store.set(
|
|
|
|
'neckBindingLength',
|
|
|
|
(new Path()
|
|
|
|
.move(points.strapLeft)
|
|
|
|
.curve(points.strapLeftCp2, points.cbNeck, points.cbNeck)
|
|
|
|
.length() +
|
|
|
|
store.get('frontNeckOpeningLength')) *
|
|
|
|
2 *
|
2023-10-01 19:07:34 +02:00
|
|
|
0.95
|
2023-09-06 10:59:45 +02:00
|
|
|
)
|
|
|
|
|
2023-09-10 10:56:41 +02:00
|
|
|
// Warn user is SA > 10 because it makes the binding width rather large
|
|
|
|
if (sa > 10 && store.get('bindingWidth') > 61) {
|
|
|
|
store.flag.tip({
|
2023-09-12 16:19:25 +02:00
|
|
|
msg: `aaron:largeSaAdaptKnitBindingWidth`,
|
2023-09-10 10:56:41 +02:00
|
|
|
replace: {
|
|
|
|
sa: units(sa),
|
|
|
|
width: units(store.get('bindingWidth')),
|
|
|
|
},
|
|
|
|
suggest: {
|
|
|
|
text: 'flag:apply',
|
|
|
|
icon: 'options',
|
|
|
|
update: {
|
|
|
|
settings: [['options', 'knitBindingWidth'], (60 / store.get('bindingWidth')) * 6],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-09-06 10:59:45 +02:00
|
|
|
// Instructions for cutting the binding only of expand is falsy
|
|
|
|
if (complete && !expand) {
|
2022-08-09 20:17:35 +02:00
|
|
|
points.bindingAnchor = new Point(points.armhole.x / 4, points.armhole.y)
|
2023-09-06 10:59:45 +02:00
|
|
|
.attr('data-text', 'aaron:cutTwoStripsToFinishTheArmholes')
|
2022-08-09 20:17:35 +02:00
|
|
|
.attr('data-text', ':\n')
|
2023-09-06 10:59:45 +02:00
|
|
|
.attr(
|
|
|
|
'data-text',
|
|
|
|
`2x: ${units(store.get('bindingWidth'))} x ${units(store.get('armBindingLength'))}`
|
|
|
|
)
|
2022-08-09 20:17:35 +02:00
|
|
|
.attr('data-text', '\n \n')
|
2023-09-06 10:59:45 +02:00
|
|
|
.attr('data-text', 'aaron:cutOneStripToFinishTheNeckOpening')
|
2022-08-09 20:17:35 +02:00
|
|
|
.attr('data-text', ':\n')
|
|
|
|
.attr(
|
|
|
|
'data-text',
|
2023-09-06 10:59:45 +02:00
|
|
|
`${units(store.get('bindingWidth'))} x ${units(store.get('neckBindingLength'))}`
|
2022-08-09 20:17:35 +02:00
|
|
|
)
|
|
|
|
}
|
2018-08-11 16:42:35 +02:00
|
|
|
|
2023-09-06 10:59:45 +02:00
|
|
|
// dimensions
|
|
|
|
dimensions(macro, points, sa)
|
|
|
|
macro('vd', {
|
|
|
|
from: points.cbHem,
|
|
|
|
to: points.cbNeck,
|
|
|
|
x: points.cbHem.x - sa - 15,
|
|
|
|
})
|
2018-08-11 16:42:35 +02:00
|
|
|
|
2022-08-09 20:17:35 +02:00
|
|
|
return part
|
2022-09-10 20:26:11 +02:00
|
|
|
},
|
2019-05-10 13:14:31 +02:00
|
|
|
}
|