1
0
Fork 0

sparkles: Button placket

This commit is contained in:
Joost De Cock 2018-12-22 17:30:12 +01:00
parent 275a1611f9
commit 467e88f45a
13 changed files with 254 additions and 173 deletions

View file

@ -0,0 +1,102 @@
import { addButtons } 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)) {
if (id !== "seam") delete part.paths[id];
}
macro("flip");
let width = options.buttonPlacketWidth;
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20),
points.cfNeck,
points.cfNeckCp1,
points.neckCp2Front,
points.neck
);
points.placketTopOut = points.cfNeck.shift(0, width / 2);
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5);
points.placketBottomIn = points.cfHem.shift(180, width / 2);
points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
paths.saBase = new Path()
.move(points.placketBottomIn)
.line(points.placketTopIn)
.join(paths.seam.split(points.placketTopIn)[1])
.line(points.placketTopEdge)
.line(points.placketBottomEdge);
paths.seam = paths.saBase
.clone()
.close()
.attr("class", "fabric");
// Complete pattern?
if (complete) {
// Placket help lines
paths.placketOuterFold = new Path()
.move(points.placketTopOut)
.line(points.placketBottomOut)
.attr("class", "dotted");
macro("sprinkle", {
snippet: "notch",
on: ["placketTopOut", "placketBottomOut"]
});
// Buttons
addButtons(part);
// Grainline
points.grainlineFrom = points.placketBottomEdge.shift(180, width / 2);
points.grainlineTo = points.placketTopEdge.shift(180, width / 2);
macro("grainline", {
from: points.grainlineFrom,
to: points.grainlineTo
});
// Title
points.title = new Point(points.placketTopOut.x, points.cfArmhole.y);
macro("title", {
at: points.title,
nr: "1b",
title: "buttonPlacket",
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)
.line(
new Point(
points.placketBottomEdge.x + sa,
points.placketBottomEdge.y + 3 * sa
)
)
.line(
new Point(
points.placketBottomIn.x - sa,
points.placketBottomIn.y + 3 * sa
)
)
.close()
.attr("class", "fabric sa");
}
}
// Paperless?
if (paperless) {
}
return part;
};

View file

@ -1,30 +1,29 @@
import { addButtons } 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;
if (options.buttonHoleType === "seperate") {
} else {
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20),
points.cfNeck,
points.cfNeckCp1,
points.neckCp2Front,
points.neck
);
points.placketTopOut = points.cfNeck.shift(0, width / 2);
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5);
points.placketBottomIn = points.cfHem.shift(180, width / 2);
points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20),
points.cfNeck,
points.cfNeckCp1,
points.neckCp2Front,
points.neck
);
points.placketTopOut = points.cfNeck.shift(0, width / 2);
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5);
points.placketBottomIn = points.cfHem.shift(180, width / 2);
points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
paths.seam
.line(points.placketTopEdge)
.line(points.placketBottomEdge)
.line(points.cfHem)
.close();
}
paths.seam
.line(points.placketTopEdge)
.line(points.placketBottomEdge)
.line(points.cfHem)
.close();
// Complete pattern?
if (complete) {
@ -54,20 +53,7 @@ export default part => {
});
// Buttons
let len =
points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength);
for (let i = 1; i <= options.buttons; i++) {
points["button" + i] = points.cfNeck.shift(
-90,
(len / options.buttons) * i
);
snippets["button" + i] = new Snippet("button", points["button" + i]);
}
if (options.extraTopButton === "yes")
snippets.topButton = new Snippet(
"button",
points.cfNeck.shift(-90, len / options.buttons / 2)
);
addButtons(part);
// Title
macro("title", { at: points.title, nr: 1, title: "frontRight" });

View file

@ -3,26 +3,23 @@ export default part => {
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
let width = options.buttonPlacketWidth;
if (options.buttonHoleType === "seperate") {
} else {
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -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;
paths.seam.close().attr("class", "fabric");
}
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -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;
paths.seam.close().attr("class", "fabric");
// Complete pattern?
if (complete) {
// Title
macro("title", { at: points.title, nr: 1, title: "rightFront" });
macro("title", { at: points.title, nr: "1a", title: "rightFront" });
if (sa) paths.saFromArmhole.line(paths.hemSa.start());
}

View file

@ -1,47 +0,0 @@
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;
if (options.buttonHoleType === "seperate") {
} else {
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20),
points.cfNeck,
points.cfNeckCp1,
points.neckCp2Front,
points.neck
);
points.placketTopOut = points.cfNeck.shift(0, width / 2);
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5);
points.placketBottomIn = points.cfHem.shift(180, width / 2);
points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
paths.placketInnerFold = new Path()
.move(points.placketTopIn)
.line(points.placketBottomIn)
.attr("class", "help");
paths.placketOuterFold = new Path()
.move(points.placketTopOut)
.line(points.placketBottomOut)
.attr("class", "help");
paths.tmp = new Path()
.move(points.placketTopEdge)
.line(points.placketBottomEdge);
}
// Complete pattern?
if (complete) {
if (sa) {
}
}
// Paperless?
if (paperless) {
}
return part;
};

View file

@ -1,47 +0,0 @@
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;
if (options.buttonHoleType === "seperate") {
} else {
points.placketTopIn = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20),
points.cfNeck,
points.cfNeckCp1,
points.neckCp2Front,
points.neck
);
points.placketTopOut = points.cfNeck.shift(0, width / 2);
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5);
points.placketBottomIn = points.cfHem.shift(180, width / 2);
points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
paths.placketInnerFold = new Path()
.move(points.placketTopIn)
.line(points.placketBottomIn)
.attr("class", "help");
paths.placketOuterFold = new Path()
.move(points.placketTopOut)
.line(points.placketBottomOut)
.attr("class", "help");
paths.tmp = new Path()
.move(points.placketTopEdge)
.line(points.placketBottomEdge);
}
// Complete pattern?
if (complete) {
if (sa) {
}
}
// Paperless?
if (paperless) {
}
return part;
};

View file

@ -0,0 +1,68 @@
import { addButtons } 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);
paths.seam
.line(points.placketTopEdge)
.line(points.placketBottomEdge)
.line(points.cfHem)
.close();
// Complete pattern?
if (complete) {
// Placket help lines
paths.frontCenter = new Path()
.move(points.cfNeck)
.line(points.cfHem)
.attr("class", "help");
paths.placketFold1 = new Path()
.move(points.placketTopFold1)
.line(points.placketBottomFold1)
.attr("class", "dotted");
paths.placketFold2 = new Path()
.move(points.placketTopFold2)
.line(points.placketBottomFold2)
.attr("class", "dotted");
macro("sprinkle", {
snippet: "notch",
on: [
"placketTopFold1",
"placketTopFold2",
"placketBottomFold1",
"placketBottomFold2",
"cfNeck",
"cfHem"
]
});
// Buttons
addButtons(part);
// Title
macro("title", { at: points.title, nr: 1, title: "frontRight" });
if (sa) {
paths.saFromArmhole
.line(new Point(points.placketTopEdge.x, points.placketTopEdge.y - sa))
.line(points.placketTopEdge)
.move(points.placketBottomEdge)
.line(points.placketBottomEdge.shift(-90, sa * 3))
.line(paths.hemSa.start());
}
}
// Paperless?
if (paperless) {
}
return part;
};

View file

@ -1,16 +1,15 @@
import frontRightClassicSeperate from "./frontright-classic-seperate";
import frontRightClassicCuton from "./frontright-classic-cuton";
import frontRightSeamlessSeperate from "./frontright-seamless-seperate";
import frontRightSeamlessCuton from "./frontright-seamless-cuton";
import frontRightSeamless from "./frontright-seamless";
export default part => {
let { macro, options } = part.shorthand();
let { macro, options, points } = part.shorthand();
macro("flip");
points.scalebox = points.waist.shiftFractionTowards(points.cfWaist, 0.5);
macro("scalebox", { at: points.scalebox });
return options.buttonPlacketStyle === "seamless"
? options.buttonPlacketType === "seperate"
? frontRightSeamlessSeperate(part)
: frontRightSeamlessCuton(part)
? frontRightSeamless(part)
: options.buttonPlacketType === "seperate"
? frontRightClassicSeperate(part)
: frontRightClassicCuton(part);

View file

@ -8,6 +8,7 @@ import config from "../config/config";
import draftBack from "./back";
import draftFront from "./front";
import draftFrontRight from "./frontright";
import draftButtonPlacket from "./buttonplacket";
//import draftSleevecap from "./sleevecap";
//import draftSleeve from "./sleeve";
// sleeveBlock: ".Sleeve block"
@ -54,9 +55,6 @@ Simon.prototype.draftBackBase = function(part) {
Simon.prototype.draftBack = draftBack;
Simon.prototype.draftFront = draftFront;
Simon.prototype.draftFrontRight = draftFrontRight;
//Brian.prototype.draftFront = draftFront;
//Brian.prototype.draftSleevecap = draftSleevecap;
//Brian.prototype.draftSleeve = draftSleeve;
Simon.prototype.draftButtonPlacket = draftButtonPlacket;
export default Simon;

View file

@ -1,10 +1,10 @@
export const calculateReduction = function(part) {
let { store, measurements, options } = part.shorthand();
if(store.get('reduction') === true) return;
if (store.get("reduction") === true) return;
let chest = measurements.chestCircumference * (1+ options.chestEase);
let waist = measurements.naturalWaist * (1+ options.waistEase);
let hips = measurements.hipsCircumference * (1+ options.hipsEase);
let chest = measurements.chestCircumference * (1 + options.chestEase);
let waist = measurements.naturalWaist * (1 + options.waistEase);
let hips = measurements.hipsCircumference * (1 + options.hipsEase);
let waistReduction = chest - waist;
let hipsReduction = chest - hips;
@ -14,5 +14,21 @@ export const calculateReduction = function(part) {
store.set("waistReduction", waistReduction);
store.set("hipsReduction", hipsReduction);
store.set("reduction", true);
}
};
export const addButtons = function(part) {
let { points, options, snippets, Snippet } = part.shorthand();
let len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength);
for (let i = 1; i <= options.buttons; i++) {
points["button" + i] = points.cfNeck.shift(
-90,
(len / options.buttons) * i
);
snippets["button" + i] = new Snippet("button", points["button" + i]);
}
if (options.extraTopButton === "yes")
snippets.topButton = new Snippet(
"button",
points.cfNeck.shift(-90, len / options.buttons / 2)
);
};