1
0
Fork 0
freesewing/designs/hortensia/src/zipperpanel.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-01-31 09:22:15 +01:00
export default function (part) {
let { store, Point, Path, points, paths, complete, sa, paperless, macro } = part.shorthand()
2021-01-31 09:22:15 +01:00
let z = store.get('zipperWidth')
let w = (store.get('zipperPanelWidth') - z) / 2
let h = store.get('depth')
points.topLeft = new Point(0, 0)
points.topRight = new Point(w, 0)
points.bottomLeft = new Point(0, h)
points.bottomRight = new Point(w, h)
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'fabric')
// Complete?
if (complete) {
paths.text = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.attr('data-text', 'ZipperPanel')
.attr('data-text-class', 'center text-xs')
if (sa) {
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
}
}
// Paperless?
if (paperless) {
macro('hd', {
from: points.bottomLeft,
to: points.bottomRight,
2021-04-24 10:16:31 +02:00
y: points.bottomLeft.y + sa + 15,
})
macro('vd', {
from: points.bottomRight,
to: points.topRight,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + sa + 15,
})
}
return part
}