2020-06-30 15:13:28 +02:00
|
|
|
export default (part) => {
|
2019-05-10 13:14:31 +02:00
|
|
|
let {
|
|
|
|
store,
|
|
|
|
sa,
|
|
|
|
measurements,
|
|
|
|
options,
|
|
|
|
Point,
|
|
|
|
points,
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
Snippet,
|
|
|
|
snippets,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
macro
|
2019-08-03 15:03:33 +02:00
|
|
|
} = part.shorthand()
|
2018-08-06 16:19:12 +02:00
|
|
|
|
2018-12-17 14:42:28 +01:00
|
|
|
// Wrist
|
2019-08-03 15:03:33 +02:00
|
|
|
let top = paths.sleevecap.bbox().topLeft.y
|
2018-12-17 14:42:28 +01:00
|
|
|
points.centerWrist = new Point(
|
|
|
|
0,
|
|
|
|
top + measurements.shoulderToWrist * (1 + options.sleeveLengthBonus)
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
2020-06-30 15:13:28 +02:00
|
|
|
points.wristRight = points.centerWrist.shift(0, (measurements.wrist * (1 + options.cuffEase)) / 2)
|
2019-08-03 15:03:33 +02:00
|
|
|
points.wristLeft = points.wristRight.rotate(180, points.centerWrist)
|
|
|
|
points.sleeveTip = paths.sleevecap.shiftFractionAlong(0.5)
|
2018-08-08 16:12:56 +02:00
|
|
|
|
2018-12-17 14:42:28 +01:00
|
|
|
// Paths
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.sleevecap.render = false
|
2018-12-17 14:42:28 +01:00
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.bicepsLeft)
|
|
|
|
.move(points.wristLeft)
|
|
|
|
.move(points.wristRight)
|
|
|
|
.line(points.bicepsRight)
|
|
|
|
.join(paths.sleevecap)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric')
|
2018-08-06 16:19:12 +02:00
|
|
|
|
2018-12-17 14:42:28 +01:00
|
|
|
// Anchor point for sampling
|
2019-08-03 15:03:33 +02:00
|
|
|
points.gridAnchor = new Point(0, 0)
|
2018-08-06 16:19:12 +02:00
|
|
|
|
2018-12-17 14:42:28 +01:00
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
2019-08-03 15:03:33 +02:00
|
|
|
points.logo = points.centerBiceps.shiftFractionTowards(points.centerWrist, 0.3)
|
|
|
|
snippets.logo = new Snippet('logo', points.logo)
|
|
|
|
macro('title', { at: points.centerBiceps, nr: 3, title: 'sleeve' })
|
|
|
|
macro('grainline', { from: points.centerWrist, to: points.centerBiceps })
|
2018-12-17 14:42:28 +01:00
|
|
|
points.scaleboxAnchor = points.scalebox = points.centerBiceps.shiftFractionTowards(
|
|
|
|
points.centerWrist,
|
|
|
|
0.5
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
|
|
|
macro('scalebox', { at: points.scalebox })
|
2018-08-08 16:41:16 +02:00
|
|
|
|
2018-12-17 14:42:28 +01:00
|
|
|
points.frontNotch = paths.sleevecap.shiftAlong(
|
|
|
|
paths.sleevecap.length() / 2 -
|
2019-08-03 15:03:33 +02:00
|
|
|
store.get('frontShoulderToArmholePitch') -
|
|
|
|
store.get('sleevecapEase') / 2
|
|
|
|
)
|
2018-12-17 14:42:28 +01:00
|
|
|
points.backNotch = paths.sleevecap.shiftAlong(
|
|
|
|
paths.sleevecap.length() / 2 +
|
2019-08-03 15:03:33 +02:00
|
|
|
store.get('backShoulderToArmholePitch') +
|
|
|
|
store.get('sleevecapEase') / 2
|
|
|
|
)
|
|
|
|
snippets.frontNotch = new Snippet('notch', points.frontNotch)
|
|
|
|
snippets.backNotch = new Snippet('bnotch', points.backNotch)
|
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
2018-12-17 14:42:28 +01:00
|
|
|
}
|
2018-08-06 16:19:12 +02:00
|
|
|
|
2018-12-17 14:42:28 +01:00
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('vd', {
|
2018-12-17 14:42:28 +01:00
|
|
|
from: points.wristLeft,
|
|
|
|
to: points.bicepsLeft,
|
|
|
|
x: points.bicepsLeft.x - sa - 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2018-12-17 14:42:28 +01:00
|
|
|
from: points.wristLeft,
|
|
|
|
to: points.sleeveTip,
|
|
|
|
x: points.bicepsLeft.x - sa - 30
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2018-12-17 14:42:28 +01:00
|
|
|
from: points.bicepsLeft,
|
|
|
|
to: points.bicepsRight,
|
|
|
|
y: points.sleeveTip.y - sa - 30
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2018-12-17 14:42:28 +01:00
|
|
|
from: points.wristLeft,
|
|
|
|
to: points.wristRight,
|
|
|
|
y: points.wristLeft.y + sa + 30
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('pd', {
|
2018-12-17 14:42:28 +01:00
|
|
|
path: paths.sleevecap.reverse(),
|
|
|
|
d: -1 * sa - 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2018-08-06 16:19:12 +02:00
|
|
|
}
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
|
|
|
}
|