1
0
Fork 0
freesewing/packages/hugo/src/pocketfacing.js
2019-04-19 08:31:58 +02:00

51 lines
1.3 KiB
JavaScript

var pocketFacing = {
draft: function(part) {
// Remove clutter
let facing = part.paths.facing;
part.paths = {};
// prettier-ignore
let {sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, utils, store} = part.shorthand();
paths.seam = facing
.line(points.pocketTop)
.curve(points.pocketTopCp, points.pocketTip, points.pocketTip)
.line(points.facingEnd)
.close()
.attr("class", "fabric", true);
points.saStart = points.pocketTop.shift(180, store.get("facingWidth"));
// Complete pattern?
if (complete) {
points.title = points.pocketTopCp.clone();
macro("title", { at: points.title, nr: 5, title: "pocketFacing" });
if (sa) {
paths.sa = new Path()
.move(points.saStart)
.line(points.pocketTop)
.curve(points.pocketTopCp, points.pocketTip, points.pocketTip)
.line(points.facingEnd)
.offset(sa * -1)
.attr("class", "fabric sa");
paths.sa
.line(points.facingEnd)
.move(points.saStart)
.line(paths.sa.start());
}
}
// Paperless?
if (paperless) {
macro("hd", {
from: points.saStart,
to: points.pocketTop,
y: points.saStart.y - 15 - sa
});
}
return part;
}
};
export default pocketFacing;