From 028be248e5786a59b42028af9d5ce487a092427a Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Sat, 30 Mar 2019 19:01:32 +0100 Subject: [PATCH] sparkles: Added pocket lining --- packages/carlton/config/index.js | 4 +- packages/carlton/index.html | 4 +- packages/carlton/src/index.js | 2 + packages/carlton/src/pocket.js | 31 ++++++++--- packages/carlton/src/pocketlining.js | 83 ++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 11 deletions(-) create mode 100644 packages/carlton/src/pocketlining.js diff --git a/packages/carlton/config/index.js b/packages/carlton/config/index.js index 8a96b97a95a..0a960cd515f 100644 --- a/packages/carlton/config/index.js +++ b/packages/carlton/config/index.js @@ -36,7 +36,9 @@ export default { cuffFacing: ["topSleeve", "underSleeve"], pocket: "front", pocketFlap: "front", + pocketLining: "pocket", chestPocketWelt: "front", + chestPocketBag: "front", innerPocketWelt: "front", innerPocketBag: "front", innerPocketTab: "front", @@ -51,6 +53,7 @@ export default { topSleeve: "bentTopSleeve", underSleeve: "bentUnderSleeve", collar: "collarStand", + pocketLining: "pocket", }, hide: [ "bentBase", @@ -60,7 +63,6 @@ export default { "bentTopSleeve", "bentUnderSleeve", ], - //parts: ["collar"], options: { // Constants brianFitSleeve: true, diff --git a/packages/carlton/index.html b/packages/carlton/index.html index 56f601f2624..ea9f644e87c 100644 --- a/packages/carlton/index.html +++ b/packages/carlton/index.html @@ -55,11 +55,11 @@ "naturalWaistToSeat": 280, "seatCircumference": 1130 }, - //only: ["topSleeve"] + only: ["pocket", "pocketLining"] }; var pattern = new freesewing.patterns.carlton(settings); pattern.use(freesewing.plugins.theme); - //pattern.use(freesewing.plugins.designer); + pattern.use(freesewing.plugins.designer); pattern.use(freesewing.plugins.validate); pattern.draft(); //pattern.sampleOption("collarFlare"); diff --git a/packages/carlton/src/index.js b/packages/carlton/src/index.js index df2661092bc..41f39041597 100644 --- a/packages/carlton/src/index.js +++ b/packages/carlton/src/index.js @@ -15,6 +15,7 @@ import draftCollar from "./collar"; import draftCuffFacing from "./cufffacing"; import draftPocket from "./pocket"; import draftPocketFlap from "./pocketflap"; +import draftPocketLining from "./pocketlining"; import draftChestPocketWelt from "./chestpocketwelt"; import draftInnerPocketWelt from "./innerpocketwelt"; import draftInnerPocketBag from "./innerpocketbag"; @@ -58,6 +59,7 @@ Carlton.prototype.draftCollar = draftCollar; Carlton.prototype.draftCuffFacing = draftCuffFacing; Carlton.prototype.draftPocket = draftPocket; Carlton.prototype.draftPocketFlap = draftPocketFlap; +Carlton.prototype.draftPocketLining = draftPocketLining; Carlton.prototype.draftChestPocketWelt = draftChestPocketWelt; Carlton.prototype.draftInnerPocketWelt = draftInnerPocketWelt; Carlton.prototype.draftInnerPocketBag = draftInnerPocketBag; diff --git a/packages/carlton/src/pocket.js b/packages/carlton/src/pocket.js index 6301f2ee248..403c0b35934 100644 --- a/packages/carlton/src/pocket.js +++ b/packages/carlton/src/pocket.js @@ -14,6 +14,11 @@ export default function(part) { points.bottomRight.x, points.topLeft.y ); + points.edgeLeft = points.bottomLeft.shiftFractionTowards(points.topLeft, 1.25); + points.edgeRight = new Point( + points.topRight.x, + points.edgeLeft.y + ); if (options.pocketRadius > 0) { macro("round", { from: points.topLeft, @@ -31,24 +36,29 @@ export default function(part) { }); paths.seam = new Path() - .move(points.topLeft) + .move(points.edgeLeft) .line(points.roundLeftStart) .curve(points.roundLeftCp1, points.roundLeftCp2, points.roundLeftEnd) .line(points.roundRightStart) .curve(points.roundRightCp1, points.roundRightCp2, points.roundRightEnd) } else { paths.seam = new Path() - .move(points.topLeft) + .move(points.edgeLeft) .line(points.bottomLeft) .line(points.bottomRight); } paths.seam = paths.seam - .line(points.topRight) - .line(points.topLeft) + .line(points.edgeRight) + .line(points.edgeLeft) .close() .attr("class", "fabric"); + paths.fold = new Path() + .move(points.topLeft) + .line(points.topRight) + .attr("class", "fabric dashed"); + if (complete) { points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5); macro("title", { @@ -59,7 +69,7 @@ export default function(part) { macro("grainline", { from: points.bottomLeft.shift(0, 10+store.get("pocketRadius")), - to: points.topLeft.shift(0, 10+store.get("pocketRadius")), + to: points.edgeLeft.shift(0, 10+store.get("pocketRadius")), }); if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa"); @@ -70,10 +80,15 @@ export default function(part) { to: points.topRight, x: points.topRight.x + sa + 15 }); + macro("vd", { + from: points.bottomRight, + to: points.edgeRight, + x: points.topRight.x + sa + 30 + }); macro("hd", { - from: points.topLeft, - to: points.topRight, - y: points.topRight.y - sa - 15 + from: points.edgeLeft, + to: points.edgeRight, + y: points.edgeRight.y - sa - 15 }); if (options.pocketRadius > 0) { macro("hd", { diff --git a/packages/carlton/src/pocketlining.js b/packages/carlton/src/pocketlining.js new file mode 100644 index 00000000000..3c7298ed773 --- /dev/null +++ b/packages/carlton/src/pocketlining.js @@ -0,0 +1,83 @@ +export default function(part) { + let { paperless, sa, store, complete, points, options, macro, Point, paths, Path } = part.shorthand(); + + points.topLeft = points.bottomLeft.shiftFractionTowards(points.topLeft, 0.75); + points.topRight = new Point( + points.bottomRight.x, + points.topLeft.y + ); + if (options.pocketRadius > 0) { + macro("round", { + from: points.topLeft, + to: points.bottomRight, + via: points.bottomLeft, + radius: store.get("pocketRadius"), + prefix: "roundLeft" + }); + macro("round", { + from: points.bottomLeft, + to: points.topRight, + via: points.bottomRight, + radius: store.get("pocketRadius"), + prefix: "roundRight" + }); + + paths.seam = new Path() + .move(points.topLeft) + .line(points.roundLeftStart) + .curve(points.roundLeftCp1, points.roundLeftCp2, points.roundLeftEnd) + .line(points.roundRightStart) + .curve(points.roundRightCp1, points.roundRightCp2, points.roundRightEnd) + } else { + paths.seam = new Path() + .move(points.topLeft) + .line(points.bottomLeft) + .line(points.bottomRight); + } + + paths.seam = paths.seam + .line(points.topRight) + .line(points.topLeft) + .close() + .attr("class", "lining"); + + delete paths.fold; + + if (complete) { + points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5); + macro("title", { + at: points.title, + nr: 16, + title: "pocketLining" + }); + + macro("grainline", { + from: points.bottomLeft.shift(0, 10+store.get("pocketRadius")), + to: points.topLeft.shift(0, 10+store.get("pocketRadius")), + }); + + if (sa) paths.sa = paths.seam.offset(sa).attr("class", "lining sa"); + + if (paperless) { + macro("vd", { + from: points.bottomRight, + to: points.topRight, + x: points.topRight.x + sa + 15 + }); + macro("hd", { + from: points.topLeft, + to: points.topRight, + y: points.topRight.y - sa - 15 + }); + if (options.pocketRadius > 0) { + macro("hd", { + from: points.roundRightStart, + to: points.roundRightEnd, + y: points.bottomRight.y + sa + 15 + }); + } + } + } + + return part; +}