🚧 Benjamin WIP
This commit is contained in:
parent
45498afbba
commit
c68c219fe3
9 changed files with 301 additions and 10831 deletions
|
@ -15,9 +15,13 @@ export default {
|
||||||
},
|
},
|
||||||
measurements: ["neckCircumference"],
|
measurements: ["neckCircumference"],
|
||||||
dependencies: {},
|
dependencies: {},
|
||||||
inject: {},
|
inject: {
|
||||||
hide: [],
|
bow1: "base",
|
||||||
parts: ["base"],
|
bow2: "base",
|
||||||
|
bow3: "base"
|
||||||
|
},
|
||||||
|
hide: ["base"],
|
||||||
|
parts: ["ribbon"],
|
||||||
options: {
|
options: {
|
||||||
transitionLength: 0.7, // 70% of bandLength
|
transitionLength: 0.7, // 70% of bandLength
|
||||||
bandLength: {
|
bandLength: {
|
||||||
|
@ -32,13 +36,13 @@ export default {
|
||||||
},
|
},
|
||||||
tipWidth: {
|
tipWidth: {
|
||||||
pct: 15,
|
pct: 15,
|
||||||
min: 5,
|
min: 10,
|
||||||
max: 20
|
max: 20
|
||||||
},
|
},
|
||||||
knotWidth: {
|
knotWidth: {
|
||||||
pct: 7,
|
pct: 7,
|
||||||
min: 6,
|
min: 5,
|
||||||
max: 9
|
max: 10
|
||||||
},
|
},
|
||||||
bowLength: {
|
bowLength: {
|
||||||
pct: 28,
|
pct: 28,
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
"@material-ui/core": "^4.0.1",
|
"@material-ui/core": "^4.0.1",
|
||||||
"@material-ui/icons": "^4.0.1",
|
"@material-ui/icons": "^4.0.1",
|
||||||
"@material-ui/lab": "^v4.0.0-alpha.14",
|
"@material-ui/lab": "^v4.0.0-alpha.14",
|
||||||
|
"axios": "^0.19.0",
|
||||||
"pattern": "link:..",
|
"pattern": "link:..",
|
||||||
"prismjs": "1.16.0",
|
"prismjs": "1.16.0",
|
||||||
"react": "^16.8",
|
"react": "^16.8",
|
||||||
"react-dom": "^16.8",
|
"react-dom": "^16.8",
|
||||||
"react-scripts": "^3.0.0",
|
"react-scripts": "^3.0.0",
|
||||||
|
"tlds": "^1.203.1",
|
||||||
"typeface-roboto-condensed": "latest"
|
"typeface-roboto-condensed": "latest"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,12 +1,3 @@
|
||||||
function FlipAllPointsY(points, mirror, start, end) {
|
|
||||||
for (var point in points) {
|
|
||||||
if (point.substr(0, start.length) == start) {
|
|
||||||
console.log(points[point]);
|
|
||||||
points[end + point.substr(start.length)] = points[point].flipY(mirror);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function(part) {
|
export default function(part) {
|
||||||
let {
|
let {
|
||||||
store,
|
store,
|
||||||
|
@ -19,7 +10,7 @@ export default function(part) {
|
||||||
snippets,
|
snippets,
|
||||||
options,
|
options,
|
||||||
measurements,
|
measurements,
|
||||||
final,
|
complete,
|
||||||
paperless,
|
paperless,
|
||||||
macro
|
macro
|
||||||
} = part.shorthand();
|
} = part.shorthand();
|
||||||
|
@ -45,33 +36,64 @@ export default function(part) {
|
||||||
const bow = store.get("bowLength");
|
const bow = store.get("bowLength");
|
||||||
|
|
||||||
// Points
|
// Points
|
||||||
points.bandTopLeft = new Point(0, ribbon / -2);
|
points.bandBottomLeft = new Point(0, ribbon / 2);
|
||||||
points.bandBottomLeft = points.bandTopLeft.flipY();
|
points.bandTopLeft = points.bandBottomLeft.flipY();
|
||||||
points.bandTopRight = points.bandTopLeft.shift(0, band);
|
points.bandBottomRight = points.bandBottomLeft.shift(0, band);
|
||||||
points.bandBottomRight = points.bandTopRight.flipY();
|
points.bandTopRight = points.bandBottomRight.flipY();
|
||||||
|
|
||||||
points.transitionTopRight = new Point(band + transition, knot / -2);
|
points.transitionBottomRight = new Point(band + transition, knot / 2);
|
||||||
points.transitionBottomRight = points.transitionTopRight.flipY();
|
points.transitionTopRight = points.transitionBottomRight.flipY();
|
||||||
|
|
||||||
points.tip1Top = new Point(band + transition + 0.5 * bow, tip / -2);
|
points.tip1Bottom = new Point(band + transition + 0.5 * bow, tip / 2);
|
||||||
points.tip1Bottom = points.tip1Top.flipY();
|
points.tip1Top = points.tip1Bottom.flipY();
|
||||||
points.tip2Top = new Point(band + transition + 1.5 * bow, tip / -2);
|
points.tip2Bottom = new Point(band + transition + 1.5 * bow, tip / 2);
|
||||||
points.tip2Bottom = points.tip2Top.flipY();
|
points.tip2Top = points.tip2Bottom.flipY();
|
||||||
points.knotTop = new Point(band + transition + bow, knot / -2);
|
points.knotBottom = new Point(band + transition + bow, knot / 2);
|
||||||
points.knotBottom = points.knotTop.flipY();
|
points.knotTop = points.knotBottom.flipY();
|
||||||
|
|
||||||
if (options.endStyle === "pointed" || options.endStyle === "rounded") {
|
if (options.endStyle === "pointed" || options.endStyle === "rounded") {
|
||||||
points.tip = new Point(points.tip2Bottom.x + points.tip2Bottom.y, 0);
|
points.tip = new Point(points.tip2Bottom.x + points.tip2Bottom.y, 0);
|
||||||
} else points.tip = new Point(points.tip2Bottom.x, 0);
|
} else points.tip = new Point(points.tip2Bottom.x, 0);
|
||||||
|
|
||||||
|
points.grainlineStart = new Point(0, 0);
|
||||||
|
points.titleAnchor = new Point(points.tip1Top.x, 0);
|
||||||
|
|
||||||
|
// Paths
|
||||||
|
paths.cap = new Path().move(points.tip2Bottom);
|
||||||
|
if (options.endStyle === "straight") {
|
||||||
|
paths.cap = new Path().move(points.tip2Bottom).line(points.tip2Top);
|
||||||
|
} else if (options.endStyle === "pointed") {
|
||||||
|
paths.cap = new Path()
|
||||||
|
.move(points.tip2Bottom)
|
||||||
|
.line(points.tip)
|
||||||
|
.line(points.tip2Top);
|
||||||
|
} else {
|
||||||
|
points.roundBottom = new Point(points.tip.x, points.tip2Bottom.y);
|
||||||
|
points.roundTop = points.roundBottom.flipY();
|
||||||
|
macro("round", {
|
||||||
|
from: points.tip2Bottom,
|
||||||
|
to: points.tip,
|
||||||
|
via: points.roundBottom,
|
||||||
|
prefix: "bottom"
|
||||||
|
});
|
||||||
|
macro("round", {
|
||||||
|
from: points.tip,
|
||||||
|
to: points.tip2Top,
|
||||||
|
via: points.roundTop,
|
||||||
|
prefix: "top"
|
||||||
|
});
|
||||||
|
paths.cap = paths.bottomRounded.join(paths.topRounded);
|
||||||
|
}
|
||||||
|
paths.cap.render = false;
|
||||||
|
|
||||||
if (options.bowStyle === "diamond" || options.bowStyle === "butterfly") {
|
if (options.bowStyle === "diamond" || options.bowStyle === "butterfly") {
|
||||||
const cpl = options.bowStyle === "diamond" ? bow / 10 : bow / 4;
|
const cpl = options.bowStyle === "diamond" ? bow / 10 : bow / 4;
|
||||||
|
|
||||||
points.transitionBottomRightCp1 = points.bandBottomRight.shiftOutwards(
|
points.transitionBottomRightCp2 = points.bandBottomRight.shiftOutwards(
|
||||||
points.transitionBottomRight,
|
points.transitionBottomRight,
|
||||||
cpl
|
cpl
|
||||||
);
|
);
|
||||||
points.transitionTopRightCp2 = points.transitionBottomRightCp1.flipY();
|
points.transitionTopRightCp1 = points.transitionBottomRightCp2.flipY();
|
||||||
points.tip1TopCp2 = points.tip1Top.shift(180, cpl);
|
points.tip1TopCp2 = points.tip1Top.shift(180, cpl);
|
||||||
points.tip1TopCp1 = points.tip1Top.shift(0, cpl);
|
points.tip1TopCp1 = points.tip1Top.shift(0, cpl);
|
||||||
points.tip1BottomCp1 = points.tip1Bottom.shift(180, cpl);
|
points.tip1BottomCp1 = points.tip1Bottom.shift(180, cpl);
|
||||||
|
@ -82,219 +104,120 @@ export default function(part) {
|
||||||
points.knotBottomCp1 = points.knotBottom.shift(180, cpl);
|
points.knotBottomCp1 = points.knotBottom.shift(180, cpl);
|
||||||
points.tip2TopCp2 = points.tip2Top.shift(180, cpl);
|
points.tip2TopCp2 = points.tip2Top.shift(180, cpl);
|
||||||
points.tip2BottomCp1 = points.tip2Bottom.shift(180, cpl);
|
points.tip2BottomCp1 = points.tip2Bottom.shift(180, cpl);
|
||||||
}
|
|
||||||
|
|
||||||
paths.test = new Path()
|
paths.seam = new Path()
|
||||||
.move(points.bandTopLeft)
|
.move(points.bandTopLeft)
|
||||||
.line(points.bandTopRight)
|
.line(points.bandBottomLeft)
|
||||||
.line(points.transitionTopRight)
|
.line(points.bandBottomRight)
|
||||||
.line(points.tip2Top)
|
.line(points.transitionBottomRight)
|
||||||
.line(points.tip)
|
.curve(
|
||||||
.line(points.tip2Bottom)
|
points.transitionBottomRightCp2,
|
||||||
.line(points.transitionBottomRight)
|
points.tip1BottomCp1,
|
||||||
.line(points.bandBottomRight)
|
points.tip1Bottom
|
||||||
.line(points.bandBottomLeft)
|
)
|
||||||
.line(points.bandTopLeft)
|
.curve(points.tip1BottomCp2, points.knotBottomCp1, points.knotBottom)
|
||||||
.close();
|
.curve(points.knotBottomCp2, points.tip2BottomCp1, points.tip2Bottom)
|
||||||
|
.join(paths.cap)
|
||||||
return part;
|
.line(points.tip2Top)
|
||||||
|
.curve(points.tip2TopCp2, points.knotTopCp1, points.knotTop)
|
||||||
let butterfly =
|
.curve(points.knotTopCp2, points.tip1TopCp1, points.tip1Top)
|
||||||
options.bowStyle == "butterfly" || options.bowStyle == "diamond";
|
.curve(
|
||||||
//const bcAdjust = options.bowStyle == "diamond" ? 10 : hhbl - 5;
|
points.tip1TopCp2,
|
||||||
|
points.transitionTopRightCp1,
|
||||||
points.LowTip = points.LowTipEdge.shift(
|
points.transitionTopRight
|
||||||
0,
|
)
|
||||||
bandLength + transitionLength + halfBowLength * 3
|
.line(points.bandTopRight)
|
||||||
);
|
.line(points.bandTopLeft)
|
||||||
points.Tip = points.Origin.shift(
|
.close();
|
||||||
0,
|
|
||||||
bandLength + transitionLength + halfBowLength * 3 + tipAdjustment
|
|
||||||
);
|
|
||||||
|
|
||||||
if (butterfly) {
|
|
||||||
points.LowTransitionEndCp2 = points.LowBandEnd.shiftOutwards(
|
|
||||||
points.LowTransitionEnd,
|
|
||||||
bcAdjust
|
|
||||||
);
|
|
||||||
points.LowHump = points.LowTipEdge.shift(
|
|
||||||
0,
|
|
||||||
bandLength + transitionLength + halfBowLength
|
|
||||||
);
|
|
||||||
points.LowHumpCp1 = points.LowHump.shift(180, bcAdjust);
|
|
||||||
points.LowHumpCp2 = points.LowHump.shift(0, bcAdjust);
|
|
||||||
points.LowValley = points.LowKnotEdge.shift(
|
|
||||||
0,
|
|
||||||
bandLength + transitionLength + halfBowLength * 2
|
|
||||||
);
|
|
||||||
points.LowValleyCp1 = points.LowValley.shift(180, bcAdjust);
|
|
||||||
points.LowValleyCp2 = points.LowValley.shift(0, bcAdjust);
|
|
||||||
points.LowTipCp1 = points.LowTip.shift(180, bcAdjust);
|
|
||||||
}
|
|
||||||
|
|
||||||
points.LowTipCp2 = points.LowTip.shiftTowards(
|
|
||||||
points.LowTipEdge,
|
|
||||||
-tipAdjustment
|
|
||||||
);
|
|
||||||
points.TipCp1 = points.Tip.shift(-90, halfTipWidth / 4);
|
|
||||||
points.TipCp2 = points.Tip.shift(90, halfTipWidth / 4);
|
|
||||||
|
|
||||||
FlipAllPointsY(points, points.Origin, "Low", "Top");
|
|
||||||
|
|
||||||
if (options.endStyle == "rounded") {
|
|
||||||
tieTip
|
|
||||||
.move(points.LowTip)
|
|
||||||
.curve(points.LowTipCp2, points.TipCp1, points.Tip)
|
|
||||||
.curve(points.TipCp2, points.TopTipCp2, points.TopTip);
|
|
||||||
} else {
|
} else {
|
||||||
tieTip
|
paths.seam = new Path()
|
||||||
.move(points.LowTip)
|
.move(points.bandTopLeft)
|
||||||
.line(points.Tip)
|
.line(points.bandBottomLeft)
|
||||||
.line(points.TopTip);
|
.line(points.bandBottomRight)
|
||||||
|
.line(points.transitionBottomRight)
|
||||||
|
.line(points.tip2Bottom)
|
||||||
|
.join(paths.cap)
|
||||||
|
.line(points.tip2Top)
|
||||||
|
.line(points.transitionTopRight)
|
||||||
|
.line(points.bandTopRight)
|
||||||
|
.line(points.bandTopLeft)
|
||||||
|
.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (butterfly) {
|
paths.seam.attr("class", "fabric");
|
||||||
tieLowKnot
|
|
||||||
.move(points.LowTransitionEnd)
|
|
||||||
.curve(points.LowTransitionEndCp2, points.LowHumpCp1, points.LowHump)
|
|
||||||
.curve(points.LowHumpCp2, points.LowValleyCp1, points.LowValley)
|
|
||||||
.curve(points.LowValleyCp2, points.LowTipCp1, points.LowTip);
|
|
||||||
tieTopKnot = tieTopKnot
|
|
||||||
.move(points.TopTransitionEnd)
|
|
||||||
.curve(points.TopTransitionEndCp2, points.TopHumpCp1, points.TopHump)
|
|
||||||
.curve(points.TopHumpCp2, points.TopValleyCp1, points.TopValley)
|
|
||||||
.curve(points.TopValleyCp2, points.TopTipCp1, points.TopTip)
|
|
||||||
.reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
tieEnd
|
// Complete?
|
||||||
.move(points.TopTransitionEnd)
|
if (complete) {
|
||||||
.line(points.TopBandEnd)
|
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||||
.line(points.TopBandStart)
|
|
||||||
.line(points.Origin);
|
|
||||||
|
|
||||||
paths.tie = new Path()
|
|
||||||
.move(points.Origin)
|
|
||||||
.join(tieStart)
|
|
||||||
.join(tieLowKnot)
|
|
||||||
.join(tieTip)
|
|
||||||
.join(tieTopKnot)
|
|
||||||
.join(tieEnd)
|
|
||||||
.close()
|
|
||||||
.attr("class", "fabric");
|
|
||||||
|
|
||||||
// Final?
|
|
||||||
if (final) {
|
|
||||||
points.grainlineLeft = points.Origin.shift(0, 30);
|
|
||||||
points.grainlineRight = points.Origin.shift(
|
|
||||||
0,
|
|
||||||
bandLength + transitionLength
|
|
||||||
);
|
|
||||||
macro("grainline", {
|
macro("grainline", {
|
||||||
from: points.grainlineLeft,
|
from: points.grainlineStart,
|
||||||
to: points.grainlineRight
|
to: points.tip
|
||||||
});
|
});
|
||||||
|
points.logoAnchor = points.tip.shift(180, 20);
|
||||||
points.titleAnchor = points.Origin.shift(
|
snippets.logo = new Snippet("logo", points.logoAnchor).attr(
|
||||||
0,
|
"data-scale",
|
||||||
bandLength + transitionLength + halfBowLength + 6
|
0.5
|
||||||
);
|
);
|
||||||
macro("title", { at: points.titleAnchor, nr: 1, title: "Bow Tie" });
|
|
||||||
|
|
||||||
if (!paperless) {
|
// Paperless?
|
||||||
let scaleboxAnchor = points.LowTipEdge.shift(-90, 30).shift(0, 50);
|
if (paperless) {
|
||||||
macro("scalebox", { at: scaleboxAnchor });
|
let baseY = points.tip2Bottom.y + 15 + sa;
|
||||||
}
|
if (options.bowStyle === "butterfly" || options.bowStyle === "diamond") {
|
||||||
|
macro("hd", {
|
||||||
let logoAnchor = points.Tip.shift(0, 40);
|
from: points.knotBottom,
|
||||||
snippets.logo = new Snippet("logo", logoAnchor);
|
to: points.tip2Bottom,
|
||||||
|
y: baseY
|
||||||
// Dummy line
|
});
|
||||||
let h1 = logoAnchor.shift(0, 50);
|
baseY += 15;
|
||||||
let h2 = h1.shift(0, 1);
|
macro("hd", {
|
||||||
|
from: points.tip1Bottom,
|
||||||
paths.hidden = new Path()
|
to: points.tip2Bottom,
|
||||||
.move(h1)
|
y: baseY
|
||||||
.line(h2)
|
});
|
||||||
.attr("class", "hidden");
|
baseY += 15;
|
||||||
}
|
|
||||||
|
|
||||||
if (sa) {
|
|
||||||
paths.sa = paths.tie.offset(sa).attr("class", "fabric sa");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paperless?
|
|
||||||
if (paperless) {
|
|
||||||
macro("hd", {
|
|
||||||
from: points.LowBandStart,
|
|
||||||
to: points.LowBandEnd,
|
|
||||||
y: points.LowBandEdge.y + 15
|
|
||||||
});
|
|
||||||
macro("hd", {
|
|
||||||
from: points.LowBandEnd,
|
|
||||||
to: points.LowTransitionEnd,
|
|
||||||
y: points.LowBandEdge.y + 15
|
|
||||||
});
|
|
||||||
macro("vd", {
|
|
||||||
from: points.LowBandStart,
|
|
||||||
to: points.TopBandStart,
|
|
||||||
x: points.LowBandStart.x - 15
|
|
||||||
});
|
|
||||||
macro("vd", {
|
|
||||||
from: points.LowTip,
|
|
||||||
to: points.TopTip,
|
|
||||||
x: points.Tip.x + 15
|
|
||||||
});
|
|
||||||
|
|
||||||
if (butterfly) {
|
|
||||||
macro("hd", {
|
|
||||||
from: points.LowTransitionEnd,
|
|
||||||
to: points.LowHump,
|
|
||||||
y: points.LowTip.y + 15
|
|
||||||
});
|
|
||||||
macro("hd", {
|
|
||||||
from: points.LowHump,
|
|
||||||
to: points.LowValley,
|
|
||||||
y: points.LowTip.y + 15
|
|
||||||
});
|
|
||||||
macro("hd", {
|
|
||||||
from: points.LowValley,
|
|
||||||
to: points.LowTip,
|
|
||||||
y: points.LowTip.y + 15
|
|
||||||
});
|
|
||||||
|
|
||||||
//macro('vd', { from: points.LowTransitionEnd, to: points.TopTransitionEnd, x: points.LowTransitionEnd.x });
|
|
||||||
macro("vd", {
|
|
||||||
from: points.LowHump,
|
|
||||||
to: points.TopHump,
|
|
||||||
x: points.LowHump.x
|
|
||||||
});
|
|
||||||
macro("vd", {
|
|
||||||
from: points.LowValley,
|
|
||||||
to: points.TopValley,
|
|
||||||
x: points.LowValley.x
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (options.bowStyle == "widesquare") {
|
|
||||||
macro("vd", {
|
macro("vd", {
|
||||||
from: points.LowTransitionEnd,
|
from: points.tip1Bottom,
|
||||||
to: points.TopTransitionEnd,
|
to: points.tip1Top
|
||||||
x: points.LowTransitionEnd.x
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
macro("hd", {
|
macro("hd", {
|
||||||
from: points.LowTransitionEnd,
|
from: points.transitionBottomRight,
|
||||||
to: points.LowTip,
|
to: points.tip2Bottom,
|
||||||
y: points.LowTip.y + 15
|
y: baseY
|
||||||
});
|
});
|
||||||
}
|
baseY += 15;
|
||||||
|
|
||||||
if (tipAdjustment) {
|
|
||||||
macro("hd", {
|
macro("hd", {
|
||||||
from: points.LowTip,
|
from: points.bandBottomRight,
|
||||||
to: points.Tip,
|
to: points.tip2Bottom,
|
||||||
y: points.LowTip.y + 15
|
y: baseY
|
||||||
});
|
});
|
||||||
|
baseY += 15;
|
||||||
|
macro("hd", {
|
||||||
|
from: points.bandBottomLeft,
|
||||||
|
to: points.tip2Bottom,
|
||||||
|
y: baseY
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.bandBottomRight,
|
||||||
|
to: points.bandTopRight
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.transitionBottomRight,
|
||||||
|
to: points.transitionTopRight
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.tip2Bottom,
|
||||||
|
to: points.tip2Top,
|
||||||
|
x: points.tip.x + 15 + sa
|
||||||
|
});
|
||||||
|
if (options.endStyle !== "straight") {
|
||||||
|
macro("hd", {
|
||||||
|
from: points.tip2Bottom,
|
||||||
|
to: points.tip,
|
||||||
|
y: points.tip2Bottom.y + 15 + sa
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
packages/benjamin/src/bow1.js
Normal file
27
packages/benjamin/src/bow1.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
complete,
|
||||||
|
macro,
|
||||||
|
points,
|
||||||
|
paths,
|
||||||
|
snippets,
|
||||||
|
Snippet,
|
||||||
|
sa
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
paths.seam.render = true;
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
if (sa) paths.sa.render = true;
|
||||||
|
macro("title", {
|
||||||
|
at: points.titleAnchor,
|
||||||
|
nr: 1,
|
||||||
|
title: "bowTie",
|
||||||
|
scale: 0.8
|
||||||
|
});
|
||||||
|
points.scaleboxAnchor = points.bandTopLeft.shift(30, 80);
|
||||||
|
macro("scalebox", { at: points.scaleboxAnchor });
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
22
packages/benjamin/src/bow2.js
Normal file
22
packages/benjamin/src/bow2.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { options, points, paths, complete, macro, sa } = part.shorthand();
|
||||||
|
|
||||||
|
if (options.adjustmentRibbon) {
|
||||||
|
part.render = false;
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
paths.seam.render = true;
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
if (sa) paths.sa.render = true;
|
||||||
|
macro("title", {
|
||||||
|
at: points.titleAnchor,
|
||||||
|
nr: 2,
|
||||||
|
title: "bowTie",
|
||||||
|
scale: 0.8
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
20
packages/benjamin/src/bow3.js
Normal file
20
packages/benjamin/src/bow3.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { options, points, paths, complete, macro, sa } = part.shorthand();
|
||||||
|
|
||||||
|
if (options.adjustmentRibbon) {
|
||||||
|
part.render = false;
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
if (sa) paths.sa.render = true;
|
||||||
|
macro("title", {
|
||||||
|
at: points.titleAnchor,
|
||||||
|
nr: 3,
|
||||||
|
title: "bowTie",
|
||||||
|
scale: 0.8
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
|
@ -3,11 +3,19 @@ import plugins from "@freesewing/plugin-bundle";
|
||||||
import config from "../config";
|
import config from "../config";
|
||||||
// Parts
|
// Parts
|
||||||
import draftBase from "./base";
|
import draftBase from "./base";
|
||||||
|
import draftBow1 from "./bow1";
|
||||||
|
import draftBow2 from "./bow2";
|
||||||
|
import draftBow3 from "./bow3";
|
||||||
|
import draftRibbon from "./ribbon";
|
||||||
|
|
||||||
// Create new design
|
// Create new design
|
||||||
const benjamin = new freesewing.Design(config, plugins);
|
const benjamin = new freesewing.Design(config, plugins);
|
||||||
|
|
||||||
// Attach draft methods to prototype
|
// Attach draft methods to prototype
|
||||||
benjamin.prototype.draftBase = draftBase;
|
benjamin.prototype.draftBase = draftBase;
|
||||||
|
benjamin.prototype.draftBow1 = draftBow1;
|
||||||
|
benjamin.prototype.draftBow2 = draftBow2;
|
||||||
|
benjamin.prototype.draftBow3 = draftBow3;
|
||||||
|
benjamin.prototype.draftRibbon = draftRibbon;
|
||||||
|
|
||||||
export default benjamin;
|
export default benjamin;
|
||||||
|
|
69
packages/benjamin/src/ribbon.js
Normal file
69
packages/benjamin/src/ribbon.js
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
Path,
|
||||||
|
measurements,
|
||||||
|
store,
|
||||||
|
options,
|
||||||
|
complete,
|
||||||
|
macro,
|
||||||
|
points,
|
||||||
|
paths,
|
||||||
|
sa,
|
||||||
|
paperless
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
if (!options.adjustmentRibbon) {
|
||||||
|
part.render = false;
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Points
|
||||||
|
points.bottomLeft = new Point(0, 0.5 * store.get("ribbonWidth"));
|
||||||
|
points.topLeft = points.bottomLeft.flipY();
|
||||||
|
// FIXME: How long should this adjustment ribbon be?
|
||||||
|
points.bottomRight = points.bottomLeft.shift(
|
||||||
|
0,
|
||||||
|
measurements.neckCircumference
|
||||||
|
);
|
||||||
|
points.topRight = points.bottomRight.flipY();
|
||||||
|
points.titleAnchor = points.topLeft.shiftFractionTowards(
|
||||||
|
points.bottomRight,
|
||||||
|
0.5
|
||||||
|
);
|
||||||
|
|
||||||
|
// Paths
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.topLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.topRight)
|
||||||
|
.line(points.topLeft)
|
||||||
|
.close()
|
||||||
|
.attr("class", "fabric");
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||||
|
macro("title", {
|
||||||
|
at: points.titleAnchor,
|
||||||
|
nr: 4,
|
||||||
|
title: "ribbon",
|
||||||
|
scale: 0.5
|
||||||
|
});
|
||||||
|
|
||||||
|
if (paperless) {
|
||||||
|
macro("hd", {
|
||||||
|
from: points.bottomLeft,
|
||||||
|
to: points.bottomRight,
|
||||||
|
y: points.bottomLeft.y + 15 + sa
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.bottomRight,
|
||||||
|
to: points.topRight,
|
||||||
|
x: points.topRight.x + 15 + sa
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue