1
0
Fork 0
freesewing/packages/carlton/src/innerpockettab.js

58 lines
1.4 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, macro, Point, paths, Path } = part.shorthand()
2019-03-25 18:20:15 +01:00
2019-08-03 15:03:33 +02:00
points.topLeft = new Point(0, 0)
points.topRight = new Point(store.get('innerPocketWidth') * 1.2, 0)
2019-03-25 18:20:15 +01:00
points.bottom = new Point(
2019-08-03 15:03:33 +02:00
store.get('innerPocketWidth') * 0.6,
store.get('innerPocketWidth') * 0.6
)
points.top = new Point(store.get('innerPocketWidth') * 0.6, 0)
2019-03-25 18:20:15 +01:00
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottom)
.line(points.topRight)
.line(points.topLeft)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'lining')
2019-03-25 18:20:15 +01:00
2021-01-31 09:22:15 +01:00
paths.hint = new Path().move(points.top).line(points.bottom).attr('class', 'lining dashed')
2019-03-25 18:20:15 +01:00
2019-03-30 13:51:23 +01:00
if (complete) {
2019-08-03 15:03:33 +02:00
points.title = points.top.shiftFractionTowards(points.bottom, 0.5)
macro('title', {
2019-03-30 13:51:23 +01:00
at: points.title,
nr: 15,
2019-08-03 15:03:33 +02:00
title: 'innerPocketTab'
})
2019-03-30 13:51:23 +01:00
2019-08-03 15:03:33 +02:00
macro('grainline', {
2019-03-30 13:51:23 +01:00
from: points.top,
2019-08-03 15:03:33 +02:00
to: points.top.shift(-45, points.top.x * 0.7)
})
2019-03-30 13:51:23 +01:00
2019-08-03 15:03:33 +02:00
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'lining sa')
2019-03-30 13:51:23 +01:00
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('hd', {
2019-03-30 13:51:23 +01:00
from: points.topLeft,
to: points.top,
y: points.topLeft.y - sa - 15
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-30 13:51:23 +01:00
from: points.topLeft,
to: points.topRight,
y: points.topLeft.y - sa - 30
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-30 13:51:23 +01:00
from: points.bottom,
to: points.topRight,
x: points.topRight.x + sa + 15
2019-08-03 15:03:33 +02:00
})
2019-03-30 13:51:23 +01:00
}
}
2019-08-03 15:03:33 +02:00
return part
2019-03-25 18:20:15 +01:00
}