2019-03-03 16:04:24 +01:00
|
|
|
export default function(part) {
|
|
|
|
let {
|
|
|
|
macro,
|
|
|
|
Path,
|
|
|
|
points,
|
|
|
|
paths,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
snippets,
|
|
|
|
Snippet,
|
|
|
|
sa,
|
2019-05-10 13:14:31 +02:00
|
|
|
options
|
2019-08-03 15:03:33 +02:00
|
|
|
} = part.shorthand()
|
2019-03-03 16:04:24 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
if (!options.pocket) return part
|
2019-03-03 16:04:24 +01:00
|
|
|
|
|
|
|
// Clear paths, apart from the pocket
|
2019-08-03 15:03:33 +02:00
|
|
|
for (let p of Object.keys(paths)) delete paths[p]
|
2019-03-03 16:04:24 +01:00
|
|
|
|
|
|
|
// Paths
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.cfHem)
|
|
|
|
.line(points.pocketHem)
|
|
|
|
.line(points.pocketTip)
|
|
|
|
.curve_(points.pocketTipCp2, points.pocketTopRight)
|
|
|
|
.line(points.pocketCfTop)
|
|
|
|
.line(points.cfHem)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric')
|
2019-03-03 16:04:24 +01:00
|
|
|
|
|
|
|
// Complete?
|
|
|
|
if (complete) {
|
2019-08-03 15:03:33 +02:00
|
|
|
points.logo = points.pocketCfTop.shiftFractionTowards(points.pocketHem, 0.3)
|
|
|
|
points.title = points.pocketCfTop.shiftFractionTowards(points.pocketHem, 0.5)
|
|
|
|
snippets.logo = new Snippet('logo', points.logo)
|
|
|
|
macro('title', {
|
2019-03-03 16:04:24 +01:00
|
|
|
at: points.title,
|
|
|
|
nr: 4,
|
2019-08-03 15:03:33 +02:00
|
|
|
title: 'pocket'
|
|
|
|
})
|
2019-03-03 16:04:24 +01:00
|
|
|
if (sa) {
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
2019-03-03 16:04:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2019-03-03 16:04:24 +01:00
|
|
|
from: points.cfHem,
|
|
|
|
to: points.pocketHem,
|
|
|
|
y: points.cfHem.y + sa + 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-03 16:04:24 +01:00
|
|
|
from: points.cfHem,
|
|
|
|
to: points.pocketTip,
|
|
|
|
y: points.cfHem.y + sa + 30
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-03 16:04:24 +01:00
|
|
|
from: points.pocketCfTop,
|
|
|
|
to: points.pocketTopRight,
|
|
|
|
y: points.pocketCfTop.y - sa - 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-03 16:04:24 +01:00
|
|
|
from: points.cfHem,
|
|
|
|
to: points.pocketCfTop,
|
|
|
|
x: points.cfHem.x - sa - 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-03 16:04:24 +01:00
|
|
|
from: points.pocketHem,
|
|
|
|
to: points.pocketTip,
|
|
|
|
x: points.pocketTip.x + sa + 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-03 16:04:24 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-03-03 16:04:24 +01:00
|
|
|
}
|