2018-12-19 12:14:48 +01:00
|
|
|
import init from "./init";
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
export default function(part) {
|
2019-05-10 13:14:31 +02:00
|
|
|
let {
|
|
|
|
store,
|
|
|
|
sa,
|
|
|
|
Point,
|
|
|
|
points,
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
macro
|
|
|
|
} = part.shorthand();
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
// Initialize
|
|
|
|
init(part);
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
// height is 73.5%
|
2019-05-10 13:14:31 +02:00
|
|
|
points.topLeft = new Point(0, 0);
|
|
|
|
points.bottomLeft = points.topLeft.shift(-90, store.get("heightInset"));
|
|
|
|
points.bottomRight = new Point(store.get("legInset"), points.bottomLeft.y);
|
|
|
|
points.tip = new Point(
|
|
|
|
points.bottomRight.x * 1.111,
|
|
|
|
points.bottomRight.y - store.get("gusset")
|
|
|
|
);
|
2018-12-19 12:14:48 +01:00
|
|
|
points.tip = points.bottomRight.shiftTowards(
|
|
|
|
points.tip,
|
2019-05-10 13:14:31 +02:00
|
|
|
store.get("crotchSeamLength") -
|
|
|
|
store.get("gusset") * (1 - store.get("gussetInsetRatio"))
|
|
|
|
);
|
|
|
|
points.tipCpTop = new Point(store.get("gusset") * 1.2, 0);
|
|
|
|
points.tipCpBottom = points.tip.shift(
|
|
|
|
points.bottomRight.angle(points.tip) + 90,
|
|
|
|
store.get("gusset") * 1.5
|
|
|
|
);
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
// Store cuve length
|
2019-05-10 13:14:31 +02:00
|
|
|
store.set(
|
|
|
|
"curve",
|
|
|
|
new Path()
|
|
|
|
.move(points.tip)
|
|
|
|
.curve(points.tipCpBottom, points.tipCpTop, points.topLeft)
|
|
|
|
.length()
|
2018-12-19 12:14:48 +01:00
|
|
|
);
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
// Path
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.topLeft)
|
|
|
|
.line(points.bottomLeft)
|
|
|
|
.line(points.bottomRight)
|
|
|
|
.line(points.tip)
|
|
|
|
.curve(points.tipCpBottom, points.tipCpTop, points.topLeft)
|
|
|
|
.close()
|
2019-05-10 13:14:31 +02:00
|
|
|
.attr("class", "fabric");
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
2019-05-10 13:14:31 +02:00
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
2018-12-19 12:14:48 +01:00
|
|
|
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5);
|
2019-05-10 13:14:31 +02:00
|
|
|
macro("title", {
|
2018-12-19 12:14:48 +01:00
|
|
|
at: points.title.shift(-90, 15),
|
|
|
|
nr: 4,
|
2019-05-10 13:14:31 +02:00
|
|
|
title: "inset"
|
2018-12-19 12:14:48 +01:00
|
|
|
});
|
2019-05-10 13:14:31 +02:00
|
|
|
macro("grainline", {
|
2018-12-19 12:14:48 +01:00
|
|
|
from: points.bottomLeft.shift(0, 15),
|
2019-05-10 13:14:31 +02:00
|
|
|
to: points.topLeft.shift(0, 15)
|
2018-12-19 12:14:48 +01:00
|
|
|
});
|
|
|
|
}
|
2018-09-04 16:51:39 +02:00
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2019-05-10 13:14:31 +02:00
|
|
|
macro("vd", {
|
2018-12-19 12:14:48 +01:00
|
|
|
from: points.bottomLeft,
|
|
|
|
to: points.topLeft,
|
|
|
|
x: points.topLeft.x - 15 - sa
|
|
|
|
});
|
2019-05-10 13:14:31 +02:00
|
|
|
macro("vd", {
|
2018-12-19 12:14:48 +01:00
|
|
|
from: points.bottomRight,
|
|
|
|
to: points.tip,
|
|
|
|
x: points.tip.x + 15 + sa
|
|
|
|
});
|
2019-05-10 13:14:31 +02:00
|
|
|
macro("hd", {
|
2018-12-19 12:14:48 +01:00
|
|
|
from: points.bottomLeft,
|
|
|
|
to: points.bottomRight,
|
|
|
|
y: points.bottomRight.y + 15 + sa
|
|
|
|
});
|
2019-05-10 13:14:31 +02:00
|
|
|
macro("hd", {
|
2018-12-19 12:14:48 +01:00
|
|
|
from: points.bottomLeft,
|
|
|
|
to: points.tip,
|
|
|
|
y: points.bottomRight.y + 30 + sa
|
|
|
|
});
|
2018-09-04 16:51:39 +02:00
|
|
|
}
|
|
|
|
|
2018-12-19 12:14:48 +01:00
|
|
|
return part;
|
2019-05-10 13:14:31 +02:00
|
|
|
}
|