1
0
Fork 0

construction: Working on shared code between parts

This commit is contained in:
Joost De Cock 2018-08-05 15:53:09 +02:00
parent 424367abba
commit aec0ac3798
4 changed files with 73 additions and 6 deletions

View file

@ -2,11 +2,75 @@ import freesewing from "freesewing";
import base from "./base";
var front = {
draft: function(part) {
// prettier-ignore
let {sa, point, points, path, paths, snippet, snippets, final, paperless, macro} = freesewing.utils.shorthand(part);
draft: function(pattern) {
let part = new pattern.part().copy(pattern.parts.back);
// prettier-ignore
let {sa, point, points, path, paths, snippet, snippets, options, measurements, final, paperless, macro} = freesewing.utils.shorthand(part);
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;
points.armholeHollowCp2.x -= deeper;
points.armholePitch.x -= deeper;
points.armholePitchCp1.x -= deeper;
paths.seam = null;
paths.seam = new path()
.move(points.cbNeck)
.line(points.cbHips)
.line(points.hips)
.line(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
.curve(
points.armholeHollowCp1,
points.armholeHollowCp2,
points.armholePitch
)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
.line(points.neck)
.curve(points.neckCp1, points.cbNeck, points.cbNeck)
.close()
.attr("class", "fabric");
// Final?
if (final) {
macro("title", { at: points.title, nr: 1, title: "front" });
snippets.armholePitchNotch = new snippet("notch", points.armholePitch);
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro("pd", {
id: "armholeLengthDimension",
path: new path()
.move(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
.curve(
points.armholeHollowCp1,
points.armholeHollowCp2,
points.armholePitch
)
.curve(
points.armholePitchCp1,
points.armholePitchCp2,
points.shoulder
),
d: sa + 15
});
macro("pd", {
id: "armholePitchDimension",
path: new path()
.move(points.armholePitch)
.curve(
points.armholePitchCp1,
points.armholePitchCp2,
points.shoulder
),
d: -15
});
}
macro("title", { at: points.title, nr: 1 });
return part;
}
};