diff --git a/packages/simon/config/config.js b/packages/simon/config/config.js index fb447d03586..46ec63d411d 100644 --- a/packages/simon/config/config.js +++ b/packages/simon/config/config.js @@ -22,14 +22,16 @@ export default { backBase: "base", back: "backBase", front: "frontBase", - frontRight: "front" + frontRight: "front", + buttonPlacket: "front" }, inject: { frontBase: "base", backBase: "base", back: "backBase", front: "frontBase", - frontRight: "front" + frontRight: "front", + buttonPlacket: "front" }, hide: ["base", "frontBase", "backBase"], options: { @@ -119,7 +121,6 @@ export default { frontArmholeDeeper: { pct: 0.5, min: 0, max: 1.5 }, hemCurve: { pct: 75, min: 25, max: 100 }, hipsEase: { pct: 8, min: -4, max: 20 }, - hipsFlare: { pct: 3, min: 0, max: 5 }, lengthBonus: { pct: 0, min: -4, max: 60 }, shoulderEase: { pct: 0, min: -2, max: 6 }, shoulderSlopeReduction: { pct: 0, min: 0, max: 8 }, diff --git a/packages/simon/index.html b/packages/simon/index.html index 17094901c4b..19eae55d2db 100644 --- a/packages/simon/index.html +++ b/packages/simon/index.html @@ -108,10 +108,11 @@ let settings1 = { ...settings }; pattern1.settings.options.yokeDart = 0.15; pattern1.settings.options.lengthBonus = 0.1; pattern1.settings.options.hemStyle = "slashed"; + pattern1.settings.options.buttonPlacketStyle = "classic"; pattern1.settings.options.buttonPlacketType = "seperate"; pattern1.settings.options.collarEase = 0.1; pattern1.settings.sa = 10; - pattern1.settings.only = "frontRight"; + pattern1.settings.only = ["frontRight", "buttonPlacket"]; pattern1.draft(); console.log(pattern1); document.getElementById("svg1").innerHTML = pattern1.render(); diff --git a/packages/simon/package-lock.json b/packages/simon/package-lock.json index 47632c42c64..3a6b482a805 100644 --- a/packages/simon/package-lock.json +++ b/packages/simon/package-lock.json @@ -1321,9 +1321,9 @@ "dev": true }, "@freesewing/plugin-bundle": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.7.0.tgz", - "integrity": "sha512-uC2z3kQSbiSQyLGIS3a9GzG6RCfhVL/IYhxYr0jZePdvjxQiR4UIXaBlo3RwxfN3Rj8f35j1A8VZLLu/p0GVfQ==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.7.1.tgz", + "integrity": "sha512-XrcZzQFbvWNtulJxSgYIw/ZXDq6bCKasO/COUoIs1LEmYkU/igd/lCfW4TN8WZRrtQronKpDIbePYiPmbuFjyQ==", "requires": { "@freesewing/plugin-cutonfold": "0.10.2", "@freesewing/plugin-dimension": "0.7.3", @@ -1332,7 +1332,14 @@ "@freesewing/plugin-round": "0.2.0", "@freesewing/plugin-scalebox": "0.3.1", "@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": { @@ -1363,9 +1370,9 @@ "integrity": "sha512-F0x+zARVNd2l3IX/sK0UmH2+Y/Mw2rKwZD8eLKWBfq0zCaC3WGHmd4TzlnE0oxQpiDejAYbsliFGm0vLPQyVMg==" }, "@freesewing/plugin-flip": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@freesewing/plugin-flip/-/plugin-flip-0.1.0.tgz", - "integrity": "sha512-ijURnXp8l1TF9/96CEkAhaXCXHvgrN2kxpGbfc4Zg1un+k/wgNwl2SEHn2xi0XANsaNP77C8Fx2VjyNiqT94zg==" + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@freesewing/plugin-flip/-/plugin-flip-0.1.1.tgz", + "integrity": "sha512-0LmoacN7SYQOiAI/D5PG/HQP2mAZaXVgET9+n7wRNCMLLwKQOK5OP87K9vppPmSurfly5Pcnhs0sXj/sLNMTxQ==" }, "@freesewing/plugin-grainline": { "version": "0.2.2", diff --git a/packages/simon/package.json b/packages/simon/package.json index 2ad8800db61..daafa8dc650 100644 --- a/packages/simon/package.json +++ b/packages/simon/package.json @@ -48,9 +48,9 @@ }, "dependencies": { "@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-flip": "0.1.0", + "@freesewing/plugin-flip": "0.1.1", "freesewing": "^0.26.1" }, "devDependencies": { diff --git a/packages/simon/src/buttonplacket.js b/packages/simon/src/buttonplacket.js new file mode 100644 index 00000000000..c3689e92c76 --- /dev/null +++ b/packages/simon/src/buttonplacket.js @@ -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; +}; diff --git a/packages/simon/src/frontright-classic-cuton.js b/packages/simon/src/frontright-classic-cuton.js index 7a30ece82ab..3b564ebf572 100644 --- a/packages/simon/src/frontright-classic-cuton.js +++ b/packages/simon/src/frontright-classic-cuton.js @@ -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" }); diff --git a/packages/simon/src/frontright-classic-seperate.js b/packages/simon/src/frontright-classic-seperate.js index 0e959c6db22..65847d57557 100644 --- a/packages/simon/src/frontright-classic-seperate.js +++ b/packages/simon/src/frontright-classic-seperate.js @@ -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()); } diff --git a/packages/simon/src/frontright-seamless-cuton.js b/packages/simon/src/frontright-seamless-cuton.js deleted file mode 100644 index 175ab7f6aa8..00000000000 --- a/packages/simon/src/frontright-seamless-cuton.js +++ /dev/null @@ -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; -}; diff --git a/packages/simon/src/frontright-seamless-seperate.js b/packages/simon/src/frontright-seamless-seperate.js deleted file mode 100644 index 175ab7f6aa8..00000000000 --- a/packages/simon/src/frontright-seamless-seperate.js +++ /dev/null @@ -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; -}; diff --git a/packages/simon/src/frontright-seamless.js b/packages/simon/src/frontright-seamless.js new file mode 100644 index 00000000000..462e2da40ba --- /dev/null +++ b/packages/simon/src/frontright-seamless.js @@ -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; +}; diff --git a/packages/simon/src/frontright.js b/packages/simon/src/frontright.js index 35d9f5a3bf7..d119e2b8a4f 100644 --- a/packages/simon/src/frontright.js +++ b/packages/simon/src/frontright.js @@ -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); diff --git a/packages/simon/src/index.js b/packages/simon/src/index.js index 43a221cc003..ccc578b2226 100644 --- a/packages/simon/src/index.js +++ b/packages/simon/src/index.js @@ -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; diff --git a/packages/simon/src/shared.js b/packages/simon/src/shared.js index b4e6fa94c48..316d47ceebb 100644 --- a/packages/simon/src/shared.js +++ b/packages/simon/src/shared.js @@ -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) + ); +};