2021-01-31 09:22:15 +01:00
|
|
|
export default function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
let { paperless, sa, snippets, complete, points, options, macro, paths, Path } = part.shorthand()
|
2019-03-16 18:24:14 +01:00
|
|
|
|
|
|
|
// Adapt length
|
2019-08-03 15:03:33 +02:00
|
|
|
points.topLeft = points.edgeLeft.flipY(points.topLeft)
|
|
|
|
points.topRight = points.edgeRight.flipY(points.topRight)
|
2019-03-16 18:24:14 +01:00
|
|
|
|
|
|
|
// Clean up
|
2019-08-03 15:03:33 +02:00
|
|
|
for (let i of Object.keys(paths)) delete paths[i]
|
|
|
|
for (let i of Object.keys(snippets)) delete snippets[i]
|
2019-03-16 18:24:14 +01:00
|
|
|
|
|
|
|
// Paths
|
|
|
|
if (options.frontPocketRadius > 0) {
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.topLeft)
|
|
|
|
.line(points.leftStart)
|
|
|
|
.curve(points.leftCp1, points.leftCp2, points.leftEnd)
|
|
|
|
.line(points.rightStart)
|
|
|
|
.curve(points.rightCp1, points.rightCp2, points.rightEnd)
|
|
|
|
.line(points.topRight)
|
|
|
|
.line(points.topLeft)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'lining')
|
2019-03-16 18:24:14 +01:00
|
|
|
} else {
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.topLeft)
|
|
|
|
.line(points.bottomLeft)
|
|
|
|
.line(points.bottomRight)
|
|
|
|
.line(points.topRight)
|
|
|
|
.line(points.topLeft)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'lining')
|
2019-03-16 18:24:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (complete) {
|
|
|
|
// Title
|
2019-08-03 15:03:33 +02:00
|
|
|
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)
|
|
|
|
macro('title', {
|
2019-03-16 18:24:14 +01:00
|
|
|
at: points.title,
|
|
|
|
nr: 10,
|
2021-04-24 10:16:31 +02:00
|
|
|
title: 'pocketLining',
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-16 18:24:14 +01:00
|
|
|
|
|
|
|
// Grainline
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('grainline', {
|
|
|
|
from: points.bottomLeft.shift(0, 10),
|
2021-04-24 10:16:31 +02:00
|
|
|
to: points.topLeft.shift(0, 10),
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-16 18:24:14 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'lining sa')
|
2019-03-17 17:30:25 +01:00
|
|
|
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2019-03-17 17:30:25 +01:00
|
|
|
from: points.topLeft,
|
|
|
|
to: points.topRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.topLeft.y - sa - 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-17 17:30:25 +01:00
|
|
|
let corner = points.bottomRight
|
2019-08-03 15:03:33 +02:00
|
|
|
if (options.frontPocketRadius > 0) corner = points.rightStart
|
|
|
|
macro('vd', {
|
2019-03-17 17:30:25 +01:00
|
|
|
from: corner,
|
|
|
|
to: points.topRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.topRight.x + sa + 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-17 17:30:25 +01:00
|
|
|
}
|
2019-03-16 18:24:14 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-03-16 18:24:14 +01:00
|
|
|
}
|