2018-12-20 11:41:35 +01:00
|
|
|
export default function(part) {
|
|
|
|
// prettier-ignore
|
|
|
|
let {measurements, options, sa, Point, points, Path, paths, complete, paperless, macro, units} = part.shorthand();
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
let width =
|
|
|
|
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) *
|
2019-05-02 12:40:03 +02:00
|
|
|
options.ribbingHeight *
|
2018-12-20 11:41:35 +01:00
|
|
|
2;
|
|
|
|
let length =
|
|
|
|
measurements.wristCircumference *
|
|
|
|
(1 + options.cuffEase) *
|
2019-05-02 12:40:03 +02:00
|
|
|
(1 - options.ribbingStretch);
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
points.topLeft = new Point(0, 0);
|
|
|
|
points.bottomLeft = new Point(0, width);
|
|
|
|
points.topRight = new Point(length, 0);
|
|
|
|
points.bottomRight = new Point(length, width);
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.topLeft)
|
|
|
|
.line(points.bottomLeft)
|
|
|
|
.line(points.bottomRight)
|
|
|
|
.line(points.topRight)
|
|
|
|
.line(points.topLeft)
|
|
|
|
.close()
|
|
|
|
.attr("class", "fabric");
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
|
|
|
if (sa) {
|
|
|
|
paths.sa = paths.seam.offset(sa);
|
2018-09-21 21:30:20 +02:00
|
|
|
}
|
2019-05-02 12:40:03 +02:00
|
|
|
points.title = points.bottomLeft.shiftFractionTowards(points.topRight, 0.5);
|
2018-12-20 11:41:35 +01:00
|
|
|
macro("title", { at: points.title, nr: 9, title: "cuff" });
|
|
|
|
macro("grainline", {
|
|
|
|
from: points.bottomLeft.shift(0, 20),
|
|
|
|
to: points.topLeft.shift(0, 20)
|
|
|
|
});
|
|
|
|
}
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
|
|
|
macro("vd", {
|
|
|
|
from: points.bottomRight,
|
|
|
|
to: points.topRight,
|
|
|
|
x: points.topRight.x + sa + 15
|
|
|
|
});
|
|
|
|
macro("hd", {
|
|
|
|
from: points.bottomLeft,
|
|
|
|
to: points.bottomRight,
|
|
|
|
y: points.bottomRight.y + sa + 15
|
|
|
|
});
|
2018-09-21 21:30:20 +02:00
|
|
|
}
|
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
return part;
|
2019-05-02 12:40:03 +02:00
|
|
|
}
|