sparkles: Added buttonhole placket
This commit is contained in:
parent
415f7c483e
commit
c5d12ff4bd
8 changed files with 214 additions and 34 deletions
|
@ -24,7 +24,8 @@ export default {
|
|||
front: "frontBase",
|
||||
frontRight: "front",
|
||||
frontLeft: "front",
|
||||
buttonPlacket: "front"
|
||||
buttonPlacket: "front",
|
||||
buttonholePlacket: "front"
|
||||
},
|
||||
inject: {
|
||||
frontBase: "base",
|
||||
|
@ -33,7 +34,8 @@ export default {
|
|||
front: "frontBase",
|
||||
frontRight: "front",
|
||||
frontLeft: "front",
|
||||
buttonPlacket: "front"
|
||||
buttonPlacket: "front",
|
||||
buttonholePlacket: "front"
|
||||
},
|
||||
hide: ["base", "frontBase", "front", "backBase"],
|
||||
options: {
|
||||
|
|
|
@ -109,10 +109,10 @@ let settings1 = { ...settings };
|
|||
pattern1.settings.options.lengthBonus = 0.1;
|
||||
pattern1.settings.options.hemStyle = "slashed";
|
||||
pattern1.settings.options.buttonholePlacketStyle = "classic";
|
||||
pattern1.settings.options.buttonPlacketType = "seperate";
|
||||
pattern1.settings.options.buttonholePlacketType = "seperate";
|
||||
pattern1.settings.options.collarEase = 0.1;
|
||||
pattern1.settings.sa = 10;
|
||||
pattern1.settings.only = ["frontLeft" ];
|
||||
pattern1.settings.only = ["frontLeft", "buttonholePlacket" ];
|
||||
pattern1.draft();
|
||||
console.log(pattern1);
|
||||
document.getElementById("svg1").innerHTML = pattern1.render();
|
||||
|
|
165
packages/simon/src/buttonholeplacket.js
Normal file
165
packages/simon/src/buttonholeplacket.js
Normal file
|
@ -0,0 +1,165 @@
|
|||
import { addButtonHoles } from "./shared";
|
||||
|
||||
export default part => {
|
||||
// prettier-ignore
|
||||
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
|
||||
|
||||
for (let id of Object.keys(part.paths)) delete part.paths[id];
|
||||
let width = options.buttonholePlacketWidth;
|
||||
let fold = options.buttonholePlacketFoldWidth;
|
||||
|
||||
points.topInnerEdge = utils.lineIntersectsCurve(
|
||||
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20),
|
||||
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y - 20),
|
||||
points.cfNeck,
|
||||
points.cfNeckCp1,
|
||||
points.neckCp2Front,
|
||||
points.neck
|
||||
);
|
||||
points.bottomInnerEdge = new Point(points.topInnerEdge.x, points.cfHem.y);
|
||||
|
||||
points.placketCfNeck = points.cfNeck.shift(180, fold * 2);
|
||||
points.placketTopInnerEdgeFold = points.placketCfNeck.shift(0, width / 2);
|
||||
points.placketTopInnerEdgeOver = points.placketCfNeck.shift(
|
||||
0,
|
||||
width / 2 - fold
|
||||
);
|
||||
points.placketTopInnerEdgeUnder = points.placketCfNeck.shift(
|
||||
0,
|
||||
width / 2 + fold
|
||||
);
|
||||
points.placketTopOuterEdgeFold = points.placketCfNeck.shift(180, width / 2);
|
||||
points.placketTopOuterEdgeOver = points.placketCfNeck.shift(
|
||||
180,
|
||||
width / 2 - fold
|
||||
);
|
||||
points.placketTopOuterEdgeUnder = points.placketCfNeck.shift(
|
||||
180,
|
||||
width / 2 + fold
|
||||
);
|
||||
points.placketCfHem = points.cfHem.shift(180, fold * 2);
|
||||
points.placketBottomInnerEdgeFold = points.placketCfHem.shift(0, width / 2);
|
||||
points.placketBottomInnerEdgeOver = points.placketCfHem.shift(
|
||||
0,
|
||||
width / 2 - fold
|
||||
);
|
||||
points.placketBottomInnerEdgeUnder = points.placketCfHem.shift(
|
||||
0,
|
||||
width / 2 + fold
|
||||
);
|
||||
points.placketBottomOuterEdgeFold = points.placketCfHem.shift(180, width / 2);
|
||||
points.placketBottomOuterEdgeOver = points.placketCfHem.shift(
|
||||
180,
|
||||
width / 2 - fold
|
||||
);
|
||||
points.placketBottomOuterEdgeUnder = points.placketCfHem.shift(
|
||||
180,
|
||||
width / 2 + fold
|
||||
);
|
||||
points.placketTopEdge = points.placketTopOuterEdgeFold.shift(180, width);
|
||||
points.placketBottomEdge = points.placketBottomOuterEdgeFold.shift(
|
||||
180,
|
||||
width
|
||||
);
|
||||
|
||||
paths.saBase = new Path()
|
||||
.move(points.placketTopEdge)
|
||||
.line(points.cfNeck)
|
||||
.curve(points.cfNeckCp1, points.neckCp2Front, points.neck)
|
||||
.split(points.topInnerEdge)[0]
|
||||
.line(points.bottomInnerEdge);
|
||||
|
||||
paths.seam = paths.saBase
|
||||
.clone()
|
||||
.line(points.placketBottomEdge)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
// Placket help lines
|
||||
paths.frontCenter = new Path()
|
||||
.move(points.placketCfNeck)
|
||||
.line(points.placketCfHem)
|
||||
.attr("class", "help");
|
||||
paths.placketInnerEdgeFold = new Path()
|
||||
.move(points.placketTopInnerEdgeFold)
|
||||
.line(points.placketBottomInnerEdgeFold)
|
||||
.attr("class", "dotted");
|
||||
paths.placketInnerEdgeOver = new Path()
|
||||
.move(points.placketTopInnerEdgeOver)
|
||||
.line(points.placketBottomInnerEdgeOver)
|
||||
.attr("class", "dotted");
|
||||
paths.placketOuterEdgeFold = new Path()
|
||||
.move(points.placketTopOuterEdgeFold)
|
||||
.line(points.placketBottomOuterEdgeFold)
|
||||
.attr("class", "dotted");
|
||||
paths.placketOuterEdgeOver = new Path()
|
||||
.move(points.placketTopOuterEdgeOver)
|
||||
.line(points.placketBottomOuterEdgeOver)
|
||||
.attr("class", "dotted");
|
||||
paths.placketOuterEdgeUnder = new Path()
|
||||
.move(points.placketTopOuterEdgeUnder)
|
||||
.line(points.placketBottomOuterEdgeUnder)
|
||||
.attr("class", "dotted");
|
||||
|
||||
// Notches
|
||||
snippets["cfArmhole-notch"].anchor.x = points.cfArmhole.x - fold * 2;
|
||||
snippets["cfWaist-notch"].anchor.x = points.cfArmhole.x - fold * 2;
|
||||
snippets["cfHips-notch"].anchor.x = points.cfArmhole.x - fold * 2;
|
||||
|
||||
// Buttons
|
||||
addButtonHoles(part, "placketCfNeck");
|
||||
|
||||
// Grainline
|
||||
points.grainlineFrom = points.placketBottomEdge.shift(0, width / 2);
|
||||
points.grainlineTo = points.placketTopEdge.shift(0, width / 2);
|
||||
macro("grainline", {
|
||||
from: points.grainlineFrom,
|
||||
to: points.grainlineTo
|
||||
});
|
||||
|
||||
// Title
|
||||
points.title = new Point(points.placketCfNeck.x, points.cfArmhole.y);
|
||||
macro("title", {
|
||||
at: points.title,
|
||||
nr: "2b",
|
||||
title: "buttonholePlacket",
|
||||
scale: 0.75,
|
||||
rotation: -90
|
||||
});
|
||||
|
||||
// Logo
|
||||
points.logo = points.title.shift(-90, 120);
|
||||
snippets.logo = new Snippet("logo", points.logo)
|
||||
.attr("data-scale", 0.5)
|
||||
.attr("data-rotate", -90);
|
||||
|
||||
if (sa) {
|
||||
paths.sa = paths.saBase.offset(sa * -1);
|
||||
paths.sa
|
||||
.line(
|
||||
new Point(
|
||||
points.bottomInnerEdge.x + sa,
|
||||
points.bottomInnerEdge.y + 3 * sa
|
||||
)
|
||||
)
|
||||
.line(
|
||||
new Point(
|
||||
points.placketBottomEdge.x,
|
||||
points.placketBottomEdge.y + 3 * sa
|
||||
)
|
||||
)
|
||||
.line(points.placketBottomEdge)
|
||||
.move(points.placketTopEdge)
|
||||
.line(paths.sa.start())
|
||||
.attr("class", "fabric sa");
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
|
@ -107,7 +107,7 @@ export default part => {
|
|||
});
|
||||
|
||||
// Buttons
|
||||
addButtonHoles(part);
|
||||
addButtonHoles(part, "placketCfNeck");
|
||||
|
||||
// Title
|
||||
macro("title", { at: points.title, nr: 2, title: "frontLeft" });
|
||||
|
|
|
@ -1,32 +1,41 @@
|
|||
import { addButtonHoles } from "./shared";
|
||||
|
||||
export default part => {
|
||||
// prettier-ignore
|
||||
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
|
||||
|
||||
let width = options.buttonPlacketWidth;
|
||||
points.placketTopIn = utils.lineIntersectsCurve(
|
||||
new Point(width / -2, points.cfNeck.y + 20),
|
||||
new Point(width / -2, points.cfNeck.y - 20),
|
||||
let fold = options.buttonholePlacketFoldWidth;
|
||||
points.neckEdge = utils.lineIntersectsCurve(
|
||||
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20),
|
||||
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y - 20),
|
||||
points.cfNeck,
|
||||
points.cfNeckCp1,
|
||||
points.neckCp2Front,
|
||||
points.neck
|
||||
);
|
||||
points.placketBottomIn = points.cfHem.shift(180, width / 2);
|
||||
paths.seam = paths.seam.split(points.placketTopIn)[0];
|
||||
paths.seam.ops[0].to = points.placketBottomIn;
|
||||
points.hemEdge = new Point(points.neckEdge.x, points.cfHem.y);
|
||||
|
||||
paths.seam = paths.seam.split(points.neckEdge)[0];
|
||||
paths.seam.ops[0].to = points.hemEdge;
|
||||
paths.seam.close().attr("class", "fabric");
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
// Title
|
||||
macro("title", { at: points.title, nr: "1a", title: "rightFront" });
|
||||
macro("title", { at: points.title, nr: "2a", title: "frontLeft" });
|
||||
|
||||
if (sa) paths.saFromArmhole.line(paths.hemSa.start());
|
||||
if (sa) {
|
||||
paths.saFromArmhole.end().x = points.neckEdge.x - sa;
|
||||
paths.hemSa.start().x = points.neckEdge.x - sa;
|
||||
paths.saClosure = new Path()
|
||||
.move(paths.saFromArmhole.end())
|
||||
.line(paths.hemSa.start())
|
||||
.attr("class", "fabric sa");
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
import { addButtons } from "./shared";
|
||||
import { addButtonHoles } from "./shared";
|
||||
|
||||
export default part => {
|
||||
// prettier-ignore
|
||||
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
|
||||
|
||||
let width = options.buttonPlacketWidth;
|
||||
points.placketTopFold1 = points.cfNeck.shift(0, width / 2);
|
||||
points.placketTopFold2 = points.cfNeck.shift(0, width * 1.5);
|
||||
points.placketTopEdge = points.cfNeck.shift(0, width * 2.5);
|
||||
points.placketBottomFold1 = points.cfHem.shift(0, width / 2);
|
||||
points.placketBottomFold2 = points.cfHem.shift(0, width * 1.5);
|
||||
points.placketBottomEdge = points.cfHem.shift(0, width * 2.5);
|
||||
console.log("seamless buttonjholes");
|
||||
let fold = options.buttonholePlacketFoldWidth;
|
||||
let width = options.buttonholePlacketWidth;
|
||||
points.placketCfNeck = points.cfNeck;
|
||||
points.placketTopFold1 = points.cfNeck.shift(180, width / 2);
|
||||
points.placketTopFold2 = points.cfNeck.shift(180, width * 1.5);
|
||||
points.placketTopEdge = points.cfNeck.shift(180, width * 2.5);
|
||||
points.placketBottomFold1 = points.cfHem.shift(180, width / 2);
|
||||
points.placketBottomFold2 = points.cfHem.shift(180, width * 1.5);
|
||||
points.placketBottomEdge = points.cfHem.shift(180, width * 2.5);
|
||||
|
||||
paths.seam
|
||||
.line(points.placketTopEdge)
|
||||
.line(points.placketBottomEdge)
|
||||
.line(points.cfHem)
|
||||
.close();
|
||||
|
||||
// Complete pattern?
|
||||
|
@ -35,27 +38,27 @@ export default part => {
|
|||
macro("sprinkle", {
|
||||
snippet: "notch",
|
||||
on: [
|
||||
"cfNeck",
|
||||
"cfHem",
|
||||
"placketTopFold1",
|
||||
"placketTopFold2",
|
||||
"placketBottomFold1",
|
||||
"placketBottomFold2",
|
||||
"cfNeck",
|
||||
"cfHem"
|
||||
"placketBottomFold2"
|
||||
]
|
||||
});
|
||||
|
||||
// Buttons
|
||||
addButtons(part);
|
||||
addButtonHoles(part, "cfNeck");
|
||||
|
||||
// Title
|
||||
macro("title", { at: points.title, nr: 1, title: "frontRight" });
|
||||
macro("title", { at: points.title, nr: 2, title: "frontLeft" });
|
||||
|
||||
if (sa) {
|
||||
paths.saFromArmhole
|
||||
.line(new Point(points.placketTopEdge.x, points.placketTopEdge.y - sa))
|
||||
.line(points.placketTopEdge.shift(90, sa))
|
||||
.line(points.placketTopEdge)
|
||||
.move(points.placketBottomEdge)
|
||||
.line(points.placketBottomEdge.shift(-90, sa * 3))
|
||||
.line(points.placketBottomEdge.shift(-90, 3 * sa))
|
||||
.line(paths.hemSa.start());
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +66,5 @@ export default part => {
|
|||
// Paperless?
|
||||
if (paperless) {
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ import draftFront from "./front";
|
|||
import draftFrontRight from "./frontright";
|
||||
import draftButtonPlacket from "./buttonplacket";
|
||||
import draftFrontLeft from "./frontleft";
|
||||
import draftButtonholePlacket from "./buttonholeplacket";
|
||||
|
||||
// Constructor
|
||||
const Simon = function(settings) {
|
||||
|
@ -41,6 +42,7 @@ Simon.prototype.draftFront = draftFront;
|
|||
Simon.prototype.draftFrontRight = draftFrontRight;
|
||||
Simon.prototype.draftButtonPlacket = draftButtonPlacket;
|
||||
Simon.prototype.draftFrontLeft = draftFrontLeft;
|
||||
Simon.prototype.draftButtonholePlacket = draftButtonholePlacket;
|
||||
|
||||
export default Simon;
|
||||
|
||||
|
|
|
@ -37,5 +37,5 @@ export const addButtons = function(
|
|||
);
|
||||
};
|
||||
|
||||
export const addButtonHoles = part =>
|
||||
addButtons(part, "placketCfNeck", "buttonhole");
|
||||
export const addButtonHoles = (part, origin) =>
|
||||
addButtons(part, origin, "buttonhole");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue