61 lines
1.3 KiB
JavaScript
61 lines
1.3 KiB
JavaScript
![]() |
export default function(part) {
|
||
|
let {
|
||
|
options,
|
||
|
Point,
|
||
|
Path,
|
||
|
points,
|
||
|
paths,
|
||
|
Snippet,
|
||
|
snippets,
|
||
|
complete,
|
||
|
sa,
|
||
|
paperless,
|
||
|
macro
|
||
|
} = part.shorthand();
|
||
|
|
||
|
let w = 500 * options.size;
|
||
|
points.topLeft = new Point(0, 0);
|
||
|
points.topRight = new Point(w, 0);
|
||
|
points.bottomLeft = new Point(0, w / 2);
|
||
|
points.bottomRight = new Point(w, w / 2);
|
||
|
|
||
|
paths.seam = new Path()
|
||
|
.move(points.topLeft)
|
||
|
.line(points.bottomLeft)
|
||
|
.line(points.bottomRight)
|
||
|
.line(points.topRight)
|
||
|
.line(points.topLeft)
|
||
|
.close()
|
||
|
.attr("class", "fabric");
|
||
|
|
||
|
// Complete?
|
||
|
if (complete) {
|
||
|
points.logo = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5);
|
||
|
snippets.logo = new Snippet("logo", points.logo);
|
||
|
points.text = points.logo
|
||
|
.shift(-90, w / 8)
|
||
|
.attr("data-text", "hello")
|
||
|
.attr("data-text-class", "center");
|
||
|
|
||
|
if (sa) {
|
||
|
paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Paperless?
|
||
|
if (paperless) {
|
||
|
macro("hd", {
|
||
|
from: points.bottomLeft,
|
||
|
to: points.bottomRight,
|
||
|
y: points.bottomLeft.y + sa + 15
|
||
|
});
|
||
|
macro("vd", {
|
||
|
from: points.bottomRight,
|
||
|
to: points.topRight,
|
||
|
x: points.topRight.x + sa + 15
|
||
|
});
|
||
|
}
|
||
|
|
||
|
return part;
|
||
|
}
|