diff --git a/packages/simon/config/config.js b/packages/simon/config/config.js index 23d74e9506d..2284ecbff6e 100644 --- a/packages/simon/config/config.js +++ b/packages/simon/config/config.js @@ -20,11 +20,13 @@ export default { frontBase: "base", backBase: "base", back: "backBase", + front: "frontBase", }, inject: { frontBase: "base", backBase: "base", back: "backBase", + front: "frontBase", }, hide: [ "base", diff --git a/packages/simon/index.html b/packages/simon/index.html index e00a078e9e6..93d059d7781 100644 --- a/packages/simon/index.html +++ b/packages/simon/index.html @@ -101,9 +101,11 @@ let settings1 = { ...settings }; var pattern1 = new freesewing.patterns.simon(settings1); pattern1.with(freesewing.plugins.theme); pattern1.with(freesewing.plugins.designer); + pattern1.with(freesewing.plugins.debug); pattern1.settings.options.yokeDart = 0.15; pattern1.settings.options.lengthBonus = 0.1; - pattern1.settings.options.hemStyle = "baseball"; + pattern1.settings.options.hemStyle = "basebal"; + pattern1.settings.options.collarEase = 0.1; pattern1.settings.sa = 10; pattern1.draft(); console.log(pattern1); diff --git a/packages/simon/package-lock.json b/packages/simon/package-lock.json index ea9dae41e08..e15e42b4d2d 100644 --- a/packages/simon/package-lock.json +++ b/packages/simon/package-lock.json @@ -917,9 +917,9 @@ "dev": true }, "@freesewing/brian": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@freesewing/brian/-/brian-0.20.0.tgz", - "integrity": "sha512-vBCSoLpIOaEe4FeK8N6auEuO85LlFoJayDNP92dAW0XuB8pV5bmuehxDFkFKbA8frPH0hJgKDCD1zSTSIhWi5Q==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@freesewing/brian/-/brian-0.20.1.tgz", + "integrity": "sha512-Xdkl8x77lIPwiy5DuFrPxdTPwj+vxDcXNePmcs6RIa1wKsPafw5GNANd08KKU6GKPi7+D0MdeDfZlOV6gkuWVQ==", "requires": { "@freesewing/plugin-bundle": "0.5.1", "freesewing": "^0.23.2" @@ -975,9 +975,9 @@ "integrity": "sha512-G6L2UyEf0yIoMQwqIWTtVUluLW3EEO0hpsgPQiS4+RfEbGIgHOgzZD6dcUf8P1bCUDvHRINAyMzONyauc5eQiw==" }, "@freesewing/plugin-debug": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@freesewing/plugin-debug/-/plugin-debug-0.1.0.tgz", - "integrity": "sha512-zfKr9v5CyOcFpe50MJ6y0p/l3qfsoT/apbFsfJHTS5wzaf+AWyCwHvo14qz7R3txBGWUsI7pPQbS7gBfiQyVkA==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@freesewing/plugin-debug/-/plugin-debug-0.5.2.tgz", + "integrity": "sha512-htZeKYu5ZtpFzn8DLsNN3ebcBrzBsr0StiztdtEBNI5xU6dFWhc4qeAwktEoFaaFhBUsTq7Lp2F7Sp/XB1xlCQ==", "dev": true }, "@freesewing/plugin-designer": { diff --git a/packages/simon/package.json b/packages/simon/package.json index 7a9f0f8aac0..873f0fb7cf0 100644 --- a/packages/simon/package.json +++ b/packages/simon/package.json @@ -47,7 +47,7 @@ ] }, "dependencies": { - "@freesewing/brian": "^0.20", + "@freesewing/brian": "^0.20.1", "@freesewing/plugin-bundle": "^0.6.0", "freesewing": "^0.24" }, @@ -61,7 +61,7 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", "@freesewing/antman": "0.2.0", "@freesewing/models": "0.6.0", - "@freesewing/plugin-debug": "0.1.0", + "@freesewing/plugin-debug": "0.5.2", "@freesewing/plugin-designer": "0.10", "@freesewing/plugin-theme": "0.13.2", "@freesewing/plugin-validate": "0.2.0", diff --git a/packages/simon/src/back.js b/packages/simon/src/back.js index c64c3dd8828..2f7acec0736 100644 --- a/packages/simon/src/back.js +++ b/packages/simon/src/back.js @@ -47,8 +47,7 @@ export default part => { paths.armhole = new Path() .move(points.armhole) .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) - .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch) - .attr("class", "stroke-xxl"); + .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch); paths.armhole.render = false; if(options.yokeDart > 0) { points.tmp1 = points.armholePitch.shift(-90, points.armholePitch.dy(points.armhole) * options.yokeDart); @@ -66,8 +65,11 @@ export default part => { points.yokeDartTipCp1 = points.armholePitch.shiftFractionTowards(points.yokeDartTip, 0.4); paths.armhole = paths.armhole.split(points.yokeDartEdge)[0]; paths.armhole._curve(points.yokeDartTipCp1, points.yokeDartTip) - // FIXME: Must adapt sleeve to compensate for this dart. - // Perhaps by reducing sleevecap ease? + // Adapt armhole length to accomodate dart + store.set( + "backArmholeLength", + store.get("backArmholeLength") - points.yokeDartEdge.dist(points.armholePitch) + ); } // Cut off at yoke @@ -86,13 +88,11 @@ export default part => { .curve(points.hipsCp2, points.waistCp1, points.waist) .curve_(points.waistCp2, points.armhole) .join(paths.armhole) - .line(points.cbYoke) - .attr("class", "stroke-xxl"); + .line(points.cbYoke); paths.hemBase = new Path() .move(points.cbHem) .line(points.bballStart) .curve(points.bballCp1, points.bballCp2, points.bballEnd); - break; case "slashed": macro("round", { @@ -107,8 +107,7 @@ export default part => { .curve(points.hipsCp2, points.waistCp1, points.waist) .curve_(points.waistCp2, points.armhole) .join(paths.armhole) - .line(points.cbYoke) - .attr("class", "stroke-xxl"); + .line(points.cbYoke); paths.hemBase = new Path() .move(points.cbHem) .line(points.slashEnd) @@ -121,11 +120,8 @@ export default part => { .curve(points.hipsCp2, points.waistCp1, points.waist) .curve_(points.waistCp2, points.armhole) .join(paths.armhole) - .line(points.cbYoke) - .attr("class", "stroke-xxl"); - paths.hemBase = new Path() - .move(points.cbHem) - .line(points.hem); + .line(points.cbYoke); + paths.hemBase = new Path().move(points.cbHem).line(points.hem); } // Paths diff --git a/packages/simon/src/front.js b/packages/simon/src/front.js new file mode 100644 index 00000000000..9bf1ec36734 --- /dev/null +++ b/packages/simon/src/front.js @@ -0,0 +1,121 @@ +import { calculateReduction } from "./shared"; + + +export default part => { + // prettier-ignore + let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand(); + + const collarDelta = () => paths.collar.length() * 2 + store.get("backCollarLength") - store.get("collarLength"); + + // Populare store with data we need + calculateReduction(part); + store.set("frontArmholeLength", new Path() + .move(points.armhole) + .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) + .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch) + .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder) + .length()); + store.set("collarLength", measurements.neckCircumference * (1+options.collarEase)); + + + // Waist shaping + let reduce = store.get('waistReduction'); + if(reduce/4 > options.minimalDartShaping) reduce = reduce/8; + else reduce = reduce/4; + points.waist = points.waist.shift(180, reduce); + points.waistCp1 = points.waist.shift(-90, measurements.naturalWaistToHip * 0.5); + points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist)/2); + points.hipsCp2 = points.hips.shift(90, points.waist.dy(points.hips)/4); + + // Draft hem + paths.saBaseFromHips = new Path() + .move(points.hips) + .curve(points.hipsCp2, points.waistCp1, points.waist) + .curve_(points.waistCp2, points.armhole); + paths.saBaseFromArmhole = new Path() + .move(points.armhole) + .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) + .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch) + .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder) + .line(points.neck) + .curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck); + switch(options.hemStyle) { + case "baseball": + points.bballStart = points.cfHem.shiftFractionTowards(points.hem, 0.5); + points.bballEnd = points.hem.shiftFractionTowards(points.hips, options.hemCurve); + points.bballCp1 = points.bballStart.shiftFractionTowards(points.hem, 0.5); + points.bballCp2 = new Point(points.bballCp1.x, points.bballEnd.y); + paths.saBase = new Path() + .move(points.bballEnd) + .line(points.hips) + .join(paths.saBaseFromHips); + + paths.hemBase = new Path() + .move(points.cfHem) + .line(points.bballStart) + .curve(points.bballCp1, points.bballCp2, points.bballEnd); + break; + case "slashed": + macro("round", { + from: points.hips, + to: points.cfHem, + via: points.hem, + radius: points.hips.dist(points.hem) * options.hemCurve, + prefix: "slash", + }); + paths.saBase = new Path() + .move(points.hips) + .join(paths.saBaseFromHips); + paths.hemBase = new Path() + .move(points.cfHem) + .line(points.slashEnd) + .curve(points.slashCp2, points.slashCp1, points.slashStart); + break; + default: + paths.saBase = new Path() + .move(points.hem) + .line(points.hips) + .join(paths.saBaseFromHips); + paths.hemBase = new Path().move(points.cfHem).line(points.hem); + } + + // Paths + paths.saBase.render = false; + paths.saBaseFromHips.render = false; + paths.saBaseFromArmhole.render = false; + paths.hemBase.render = false; + paths.seam = paths.hemBase.join(paths.saBase).join(paths.saBaseFromArmhole).close().attr('class', 'fabric'); + + // Complete pattern? + if (complete) { + delete paths.cutonfold; + macro("grainline", { + from: points.cfHem.shift(0, 45), + to: points.cfNeck.shift(0, 45) + }); + macro("title", { at: points.title, nr: "X", title: "front" }); + + if(sa) { + paths.saFrench = paths.saBase.offset(sa*2).attr('class', 'fabric sa'); + paths.saFromArmhole = paths.saBaseFromArmhole.offset(sa).attr('class', 'fabric sa'); + paths.hemSa = paths.hemBase.offset(sa*3).attr('class', 'fabric sa'); + paths.saConnect = new Path() + .move(points.cfHem) + .line(paths.hemSa.start()) + .move(paths.hemSa.end()) + .line(paths.saFrench.start()) + .move(paths.saFrench.end()) + .line(paths.saFromArmhole.start()) + .move(paths.saFromArmhole.end()) + .line(points.cfNeck) + .attr('class', 'fabric sa'); + delete paths.sa; + } + } + + // Paperless? + if (paperless) { + } + + return part; +}; diff --git a/packages/simon/src/index.js b/packages/simon/src/index.js index 476ab2d53b4..cfb87ed7737 100644 --- a/packages/simon/src/index.js +++ b/packages/simon/src/index.js @@ -5,7 +5,7 @@ import config from "../config/config"; import { version } from "../package.json"; // Parts import draftBack from "./back"; -//import draftFront from "./front"; +import draftFront from "./front"; //import draftSleevecap from "./sleevecap"; //import draftSleeve from "./sleeve"; // backBlock: ".Back block" @@ -52,6 +52,7 @@ Simon.prototype.draftBackBase = function (part) { return new Brian(this.settings).draftBack(part); } Simon.prototype.draftBack = draftBack; +Simon.prototype.draftFront = draftFront;