1
0
Fork 0
freesewing/packages/florent/src/brimtop.js

70 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-04-07 17:01:58 +02:00
export default function(part) {
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,
measurements
} = part.shorthand();
paths.hint = new Path()
.move(points.tipLeft)
.curve(points.tipLeftCp2, points.outerMidCp1, points.outerMid)
.curve(points.outerMidCp2, points.tipRightCp1, points.tipRight)
.attr("class", "dashed stroke-sm");
paths.seam = paths.hint.offset(3);
paths.seam = paths.seam
.line(points.tipRight)
.curve(points.tipRightCp2, points.innerMidCp1, points.innerMid)
.curve(points.innerMidCp2, points.tipLeftCp1, points.tipLeft)
.line(paths.seam.start())
.close()
.attr("class", "fabric");
if (complete) {
2019-04-08 18:25:01 +02:00
points.title = points.innerMid.shiftFractionTowards(
points.outerMidCp2,
0.35
);
macro("title", {
at: points.title,
nr: 4,
title: "brimTop"
});
macro("grainline", {
from: points.outerMid,
to: points.innerMid
});
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
2019-04-07 17:01:58 +02:00
if (paperless) {
2019-04-08 18:25:01 +02:00
let bottom = paths.seam.edge("bottom");
macro("hd", {
from: paths.seam.edge("left"),
to: paths.seam.edge("right"),
y: points.tipLeft.y - sa - 15
});
macro("vd", {
from: bottom,
to: points.innerMid,
x: points.innerMid.x - 15
});
macro("vd", {
from: bottom,
to: points.tipRight,
x: points.tipRight.x + sa + 18
});
2019-04-07 17:01:58 +02:00
}
}
return part;
}