1
0
Fork 0

🚧 Tweaks to CFP template

This commit is contained in:
Joost De Cock 2019-05-10 08:21:33 +02:00
parent 45742d4984
commit 1ce50efed1
2 changed files with 45 additions and 11 deletions

View file

@ -10,12 +10,26 @@ export default {
department: "{{department}}",
type: "{{type}}",
difficulty: 3,
tags: [],
optionGroups: {},
tags: [
"freesewing",
"design",
"diy",
"fashion",
"made to measure",
"parametric design",
"{{type}}",
"sewing",
"sewing pattern"
],
optionGroups: {
fit: ["size"]
},
measurements: [],
dependencies: {},
inject: {},
hide: [],
parts: [],
options: {}
parts: ["box"],
options: {
size: { pct: 50, min: 10, max: 100 }
}
};

View file

@ -5,31 +5,51 @@ export default function(part) {
Path,
points,
paths,
Snippet,
snippets,
complete,
paperless
sa,
paperless,
macro
} = part.shorthand();
let w = 500 * options.size;
points.topLeft = new Point(0, 0);
points.topRight = new Point(options.size, 0);
points.bottomLeft = new Point(0, options.size);
points.bottomRight = new Point(options.size, options.size);
points.topRight = new Point(w, 0);
points.bottomLeft = new Point(0, w / 2);
points.bottomRight = new Point(w, w / 2);
paths.demo = new Path()
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.attr("data-text", "thisIsTheFrontPart")
.attr("data-text-class", "center");
.attr("class", "fabric");
// Complete?
if (complete) {
points.logo = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5);
snippets.logo = new Snippet("logo", points.logo);
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;