1
0
Fork 0
freesewing/packages/jaeger/src/undersleeve.js

104 lines
3.5 KiB
JavaScript
Raw Normal View History

2019-03-16 11:39:06 +01:00
export default function(part) {
let { sa, snippets, Snippet, utils, store, complete, points, measurements, options, macro, Point, paths, Path } = part.shorthand();
// Vent
let slope = 15;
let width = measurements.wristCircumference * (1 + options.cuffEase) * options.sleeveVentWidth;
points.ventFoldRight = points.usWristLeft.shiftOutwards(points.usWristRight, width);
points.ventHelper = points.usWristRight.shiftFractionTowards(points.elbowRight, options.sleeveVentLength);
points.ventSlopeEnd = points.ventHelper
.shiftTowards(points.usWristRight, width)
.rotate(90, points.ventHelper);
points.ventSlopeStart = utils.beamsIntersect(
points.usWristRight, points.elbowRight,
points.ventSlopeEnd, points.ventHelper.rotate(-1 * slope, points.ventSlopeEnd)
);
// Hem
let hemSa = sa ? 3*sa : 30;
points.hemHelperLeft = points.usWristLeft
.shiftTowards(points.usWristRight, hemSa)
.rotate(90, points.usWristLeft);
points.hemHelperRight = points.usWristRight
.shiftTowards(points.usWristLeft, hemSa)
.rotate(-90, points.usWristRight);
points.hemLeftIntersection = utils.beamsIntersect(
points.hemHelperLeft, points.hemHelperRight,
points.usWristLeft, points.usElbowLeft
);
points.hemRightIntersection = utils.beamsIntersect(
points.hemHelperLeft, points.hemHelperRight,
points.usWristRight, points.elbowRight
);
points.hemVentIntersection = utils.beamsIntersect(
points.hemHelperLeft, points.hemHelperRight,
points.ventFoldRight, points.ventSlopeEnd
);
points.hemLeft = points.hemLeftIntersection
.rotate(points.usWristLeft.angle(points.hemLeftIntersection) * -2, points.usWristLeft);
points.hemRight = points.hemRightIntersection
.rotate(points.usWristRight.angle(points.hemRightIntersection) * -2, points.usWristRight);
points.ventRight = points.hemVentIntersection
.rotate(points.ventFoldRight.angle(points.hemVentIntersection) * -2, points.ventFoldRight);
// Clean up - Remove this and uncomment paths below to understand what's going on
for (let i of Object.keys(paths)) delete paths[i];
// Paths
paths.seam = new Path()
.move(points.ventFoldRight)
.line(points.ventSlopeEnd)
.line(points.ventSlopeStart)
.line(points.elbowRight)
.curve(points.elbowRightCpTop, points.usRightEdgeCpBottom, points.usRightEdge)
.curve_(points.usRightEdgeCpTop, points.usTip)
.curve(points.usTipCpBottom, points.usLeftEdgeCpRight, points.usLeftEdgeRight)
2019-03-16 17:34:17 +01:00
.line(points.usLeftEdge)
2019-03-16 11:39:06 +01:00
._curve(points.usElbowLeftCpTop, points.usElbowLeft)
.line(points.usWristLeft)
2019-03-16 17:34:17 +01:00
.line(points.hemLeft)
.line(points.ventRight)
2019-03-16 11:39:06 +01:00
.line(points.ventFoldRight)
.close()
.attr("class", "fabric");
paths.ventHint = new Path()
.move(points.ventSlopeStart)
.line(points.usWristRight)
.attr("class", "stroke-sm help");
paths.hem = new Path()
.move(points.usWristLeft)
.line(points.ventFoldRight)
.attr("class", "fabric lashed");
2019-03-16 17:34:17 +01:00
if (complete) {
// Notches
macro("sprinkle", {
snippet: "notch",
on: [
"top",
"usElbowLeft",
"elbowRight",
]
});
// Title
points.title = points.tsLeftEdge.shiftFractionTowards(points.tsRightEdge, 0.5);
macro("title", {
at: points.title,
nr: 5,
title: "underSleeve"
});
// Grainline
macro("grainline", {
from: points.boxBottom,
to: points.armCenter
});
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
}
2019-03-16 11:39:06 +01:00
return part;
}