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}}", department: "{{department}}",
type: "{{type}}", type: "{{type}}",
difficulty: 3, difficulty: 3,
tags: [], tags: [
optionGroups: {}, "freesewing",
"design",
"diy",
"fashion",
"made to measure",
"parametric design",
"{{type}}",
"sewing",
"sewing pattern"
],
optionGroups: {
fit: ["size"]
},
measurements: [], measurements: [],
dependencies: {}, dependencies: {},
inject: {}, inject: {},
hide: [], hide: [],
parts: [], parts: ["box"],
options: {} options: {
size: { pct: 50, min: 10, max: 100 }
}
}; };

View file

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