1
0
Fork 0
freesewing/packages/jaeger/src/innerpocketbag.js

97 lines
2.2 KiB
JavaScript
Raw Normal View History

2021-01-31 09:22:15 +01:00
export default function (part) {
2019-08-03 15:03:33 +02:00
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
2021-04-24 10:16:31 +02:00
Path,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2019-03-16 11:39:06 +01:00
2019-08-03 15:03:33 +02:00
let width = store.get('innerPocketWidth')
let welt = store.get('innerPocketWeltHeight')
let height = width * options.innerPocketDepth
2019-03-16 11:39:06 +01:00
2019-08-03 15:03:33 +02:00
points.topLeft = new Point(0, 0)
points.topRight = new Point(width, 0)
points.foldLeft = new Point(0, height)
points.foldRight = new Point(width, height)
points.bottomLeft = new Point(0, height * 2 + welt * 2)
points.bottomRight = new Point(width, height * 2 + welt * 2)
2019-03-16 11:39:06 +01:00
// Paths
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 11:39:06 +01:00
paths.fold = new Path()
.move(points.foldLeft)
.line(points.foldRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'stroke-sm lining dashed')
2019-03-16 11:39:06 +01:00
2019-03-16 18:36:19 +01:00
if (complete) {
points.title = points.topLeft.shiftFractionTowards(points.foldRight, 0.5)
// Title
2019-08-03 15:03:33 +02:00
macro('title', {
2019-03-16 18:36:19 +01:00
at: points.title,
nr: 14,
2021-04-24 10:16:31 +02:00
title: 'innerPocketBag',
2019-08-03 15:03:33 +02:00
})
2019-03-16 18:36:19 +01:00
// Grainline
2019-08-03 15:03:33 +02:00
macro('grainline', {
2019-03-16 18:36:19 +01:00
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:36:19 +01:00
// Instructions
2019-08-03 15:03:33 +02:00
paths.fold.attr('data-text', 'foldAlongThisLine').attr('data-text-class', 'center')
2019-03-16 18:36:19 +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:25:03 +01:00
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('hd', {
2019-03-17 17:25:03 +01:00
from: points.topLeft,
to: points.topRight,
2021-04-24 10:16:31 +02:00
y: points.topRight.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 17:25:03 +01:00
from: points.bottomRight,
to: points.foldRight,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 17:25:03 +01:00
from: points.foldRight,
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
})
macro('vd', {
2019-03-17 17:25:03 +01:00
from: points.bottomRight,
to: points.topRight,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + sa + 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 17:25:03 +01:00
from: points.bottomLeft,
to: points.foldLeft,
2021-04-24 10:16:31 +02:00
x: points.topLeft.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 17:25:03 +01:00
from: points.foldLeft,
to: points.topLeft,
2021-04-24 10:16:31 +02:00
x: points.topLeft.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
2019-03-17 17:25:03 +01:00
}
2019-03-16 18:36:19 +01:00
}
2019-08-03 15:03:33 +02:00
return part
2019-03-16 11:39:06 +01:00
}