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

@ -22,14 +22,16 @@ export default {
backBase: "base", backBase: "base",
back: "backBase", back: "backBase",
front: "frontBase", front: "frontBase",
frontRight: "front" frontRight: "front",
buttonPlacket: "front"
}, },
inject: { inject: {
frontBase: "base", frontBase: "base",
backBase: "base", backBase: "base",
back: "backBase", back: "backBase",
front: "frontBase", front: "frontBase",
frontRight: "front" frontRight: "front",
buttonPlacket: "front"
}, },
hide: ["base", "frontBase", "backBase"], hide: ["base", "frontBase", "backBase"],
options: { options: {
@ -119,7 +121,6 @@ export default {
frontArmholeDeeper: { pct: 0.5, min: 0, max: 1.5 }, frontArmholeDeeper: { pct: 0.5, min: 0, max: 1.5 },
hemCurve: { pct: 75, min: 25, max: 100 }, hemCurve: { pct: 75, min: 25, max: 100 },
hipsEase: { pct: 8, min: -4, max: 20 }, hipsEase: { pct: 8, min: -4, max: 20 },
hipsFlare: { pct: 3, min: 0, max: 5 },
lengthBonus: { pct: 0, min: -4, max: 60 }, lengthBonus: { pct: 0, min: -4, max: 60 },
shoulderEase: { pct: 0, min: -2, max: 6 }, shoulderEase: { pct: 0, min: -2, max: 6 },
shoulderSlopeReduction: { pct: 0, min: 0, max: 8 }, shoulderSlopeReduction: { pct: 0, min: 0, max: 8 },

View file

@ -108,10 +108,11 @@ let settings1 = { ...settings };
pattern1.settings.options.yokeDart = 0.15; pattern1.settings.options.yokeDart = 0.15;
pattern1.settings.options.lengthBonus = 0.1; pattern1.settings.options.lengthBonus = 0.1;
pattern1.settings.options.hemStyle = "slashed"; pattern1.settings.options.hemStyle = "slashed";
pattern1.settings.options.buttonPlacketStyle = "classic";
pattern1.settings.options.buttonPlacketType = "seperate"; pattern1.settings.options.buttonPlacketType = "seperate";
pattern1.settings.options.collarEase = 0.1; pattern1.settings.options.collarEase = 0.1;
pattern1.settings.sa = 10; pattern1.settings.sa = 10;
pattern1.settings.only = "frontRight"; pattern1.settings.only = ["frontRight", "buttonPlacket"];
pattern1.draft(); pattern1.draft();
console.log(pattern1); console.log(pattern1);
document.getElementById("svg1").innerHTML = pattern1.render(); document.getElementById("svg1").innerHTML = pattern1.render();

View file

@ -1321,9 +1321,9 @@
"dev": true "dev": true
}, },
"@freesewing/plugin-bundle": { "@freesewing/plugin-bundle": {
"version": "0.7.0", "version": "0.7.1",
"resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.7.0.tgz", "resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.7.1.tgz",
"integrity": "sha512-uC2z3kQSbiSQyLGIS3a9GzG6RCfhVL/IYhxYr0jZePdvjxQiR4UIXaBlo3RwxfN3Rj8f35j1A8VZLLu/p0GVfQ==", "integrity": "sha512-XrcZzQFbvWNtulJxSgYIw/ZXDq6bCKasO/COUoIs1LEmYkU/igd/lCfW4TN8WZRrtQronKpDIbePYiPmbuFjyQ==",
"requires": { "requires": {
"@freesewing/plugin-cutonfold": "0.10.2", "@freesewing/plugin-cutonfold": "0.10.2",
"@freesewing/plugin-dimension": "0.7.3", "@freesewing/plugin-dimension": "0.7.3",
@ -1332,7 +1332,14 @@
"@freesewing/plugin-round": "0.2.0", "@freesewing/plugin-round": "0.2.0",
"@freesewing/plugin-scalebox": "0.3.1", "@freesewing/plugin-scalebox": "0.3.1",
"@freesewing/plugin-sprinkle": "0.1.0", "@freesewing/plugin-sprinkle": "0.1.0",
"@freesewing/plugin-title": "0.9.1" "@freesewing/plugin-title": "0.10.0"
},
"dependencies": {
"@freesewing/plugin-title": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/@freesewing/plugin-title/-/plugin-title-0.10.0.tgz",
"integrity": "sha512-UZYge58Cofpgjx7ODhdszTKYRURjVtP2YIkOsUR3/kzicVpAw/wuoFX9n85y9IGG+k9ImIX7/7F4AtqlhNItnQ=="
}
} }
}, },
"@freesewing/plugin-buttons": { "@freesewing/plugin-buttons": {
@ -1363,9 +1370,9 @@
"integrity": "sha512-F0x+zARVNd2l3IX/sK0UmH2+Y/Mw2rKwZD8eLKWBfq0zCaC3WGHmd4TzlnE0oxQpiDejAYbsliFGm0vLPQyVMg==" "integrity": "sha512-F0x+zARVNd2l3IX/sK0UmH2+Y/Mw2rKwZD8eLKWBfq0zCaC3WGHmd4TzlnE0oxQpiDejAYbsliFGm0vLPQyVMg=="
}, },
"@freesewing/plugin-flip": { "@freesewing/plugin-flip": {
"version": "0.1.0", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/@freesewing/plugin-flip/-/plugin-flip-0.1.0.tgz", "resolved": "https://registry.npmjs.org/@freesewing/plugin-flip/-/plugin-flip-0.1.1.tgz",
"integrity": "sha512-ijURnXp8l1TF9/96CEkAhaXCXHvgrN2kxpGbfc4Zg1un+k/wgNwl2SEHn2xi0XANsaNP77C8Fx2VjyNiqT94zg==" "integrity": "sha512-0LmoacN7SYQOiAI/D5PG/HQP2mAZaXVgET9+n7wRNCMLLwKQOK5OP87K9vppPmSurfly5Pcnhs0sXj/sLNMTxQ=="
}, },
"@freesewing/plugin-grainline": { "@freesewing/plugin-grainline": {
"version": "0.2.2", "version": "0.2.2",

View file

@ -48,9 +48,9 @@
}, },
"dependencies": { "dependencies": {
"@freesewing/brian": "^0.22.0", "@freesewing/brian": "^0.22.0",
"@freesewing/plugin-bundle": "^0.7.0", "@freesewing/plugin-bundle": "^0.7.1",
"@freesewing/plugin-buttons": "0.1.0", "@freesewing/plugin-buttons": "0.1.0",
"@freesewing/plugin-flip": "0.1.0", "@freesewing/plugin-flip": "0.1.1",
"freesewing": "^0.26.1" "freesewing": "^0.26.1"
}, },
"devDependencies": { "devDependencies": {

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 => { export default part => {
// prettier-ignore // prettier-ignore
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand(); let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
let width = options.buttonPlacketWidth; let width = options.buttonPlacketWidth;
if (options.buttonHoleType === "seperate") { points.placketTopIn = utils.lineIntersectsCurve(
} else { new Point(width / -2, points.cfNeck.y + 20),
points.placketTopIn = utils.lineIntersectsCurve( new Point(width / -2, points.cfNeck.y - 20),
new Point(width / -2, points.cfNeck.y + 20), points.cfNeck,
new Point(width / -2, points.cfNeck.y - 20), points.cfNeckCp1,
points.cfNeck, points.neckCp2Front,
points.cfNeckCp1, points.neck
points.neckCp2Front, );
points.neck points.placketTopOut = points.cfNeck.shift(0, width / 2);
); points.placketTopEdge = points.cfNeck.shift(0, width * 1.5);
points.placketTopOut = points.cfNeck.shift(0, width / 2); points.placketBottomIn = points.cfHem.shift(180, width / 2);
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5); points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomIn = points.cfHem.shift(180, width / 2); points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
points.placketBottomOut = points.cfHem.shift(0, width / 2);
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5);
paths.seam paths.seam
.line(points.placketTopEdge) .line(points.placketTopEdge)
.line(points.placketBottomEdge) .line(points.placketBottomEdge)
.line(points.cfHem) .line(points.cfHem)
.close(); .close();
}
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {
@ -54,20 +53,7 @@ export default part => {
}); });
// Buttons // Buttons
let len = addButtons(part);
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)
);
// Title // Title
macro("title", { at: points.title, nr: 1, title: "frontRight" }); 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 {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
let width = options.buttonPlacketWidth; let width = options.buttonPlacketWidth;
if (options.buttonHoleType === "seperate") { points.placketTopIn = utils.lineIntersectsCurve(
} else { new Point(width / -2, points.cfNeck.y + 20),
points.placketTopIn = utils.lineIntersectsCurve( new Point(width / -2, points.cfNeck.y - 20),
new Point(width / -2, points.cfNeck.y + 20), points.cfNeck,
new Point(width / -2, points.cfNeck.y - 20), points.cfNeckCp1,
points.cfNeck, points.neckCp2Front,
points.cfNeckCp1, points.neck
points.neckCp2Front, );
points.neck points.placketBottomIn = points.cfHem.shift(180, width / 2);
); paths.seam = paths.seam.split(points.placketTopIn)[0];
points.placketBottomIn = points.cfHem.shift(180, width / 2); paths.seam.ops[0].to = points.placketBottomIn;
paths.seam = paths.seam.split(points.placketTopIn)[0]; paths.seam.close().attr("class", "fabric");
paths.seam.ops[0].to = points.placketBottomIn;
paths.seam.close().attr("class", "fabric");
}
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {
// Title // 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()); 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 frontRightClassicSeperate from "./frontright-classic-seperate";
import frontRightClassicCuton from "./frontright-classic-cuton"; import frontRightClassicCuton from "./frontright-classic-cuton";
import frontRightSeamlessSeperate from "./frontright-seamless-seperate"; import frontRightSeamless from "./frontright-seamless";
import frontRightSeamlessCuton from "./frontright-seamless-cuton";
export default part => { export default part => {
let { macro, options } = part.shorthand(); let { macro, options, points } = part.shorthand();
macro("flip"); macro("flip");
points.scalebox = points.waist.shiftFractionTowards(points.cfWaist, 0.5);
macro("scalebox", { at: points.scalebox });
return options.buttonPlacketStyle === "seamless" return options.buttonPlacketStyle === "seamless"
? options.buttonPlacketType === "seperate" ? frontRightSeamless(part)
? frontRightSeamlessSeperate(part)
: frontRightSeamlessCuton(part)
: options.buttonPlacketType === "seperate" : options.buttonPlacketType === "seperate"
? frontRightClassicSeperate(part) ? frontRightClassicSeperate(part)
: frontRightClassicCuton(part); : frontRightClassicCuton(part);

View file

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

View file

@ -1,10 +1,10 @@
export const calculateReduction = function(part) { export const calculateReduction = function(part) {
let { store, measurements, options } = part.shorthand(); 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 chest = measurements.chestCircumference * (1 + options.chestEase);
let waist = measurements.naturalWaist * (1+ options.waistEase); let waist = measurements.naturalWaist * (1 + options.waistEase);
let hips = measurements.hipsCircumference * (1+ options.hipsEase); let hips = measurements.hipsCircumference * (1 + options.hipsEase);
let waistReduction = chest - waist; let waistReduction = chest - waist;
let hipsReduction = chest - hips; let hipsReduction = chest - hips;
@ -14,5 +14,21 @@ export const calculateReduction = function(part) {
store.set("waistReduction", waistReduction); store.set("waistReduction", waistReduction);
store.set("hipsReduction", hipsReduction); store.set("hipsReduction", hipsReduction);
store.set("reduction", true); 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)
);
};