1
0
Fork 0

construction: Prettier

This commit is contained in:
joostdecock 2018-07-24 10:16:31 +00:00 committed by Joost De Cock
parent 9fffa83c02
commit f767d653fa
3 changed files with 119 additions and 60 deletions

View file

@ -1,11 +1,18 @@
import * as F from 'freesewing' import * as F from "freesewing";
import base from './base'; import base from "./base";
var back = var back = {
{ draft: function(part, context) {
draft: function(part, context) let {
{ measurements,
let { measurements, options, points, paths, snippets, macro, final, paperless } = F.utils.shorthand(part, context); options,
points,
paths,
snippets,
macro,
final,
paperless
} = F.utils.shorthand(part, context);
base.draft(part, context); base.draft(part, context);
paths.seam = new F.path() paths.seam = new F.path()
@ -14,38 +21,38 @@ var back =
.line(points.hips) .line(points.hips)
.line(points.armhole) .line(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow) .curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
.curve(points.armholeHollowCp1, points.armholeHollowCp2, points.armholePitch) .curve(
points.armholeHollowCp1,
points.armholeHollowCp2,
points.armholePitch
)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder) .curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
.line(points.neck) .line(points.neck)
.curve(points.neckCp1, points.cbNeck, points.cbNeck) .curve(points.neckCp1, points.cbNeck, points.cbNeck)
.close() .close();
;
// Final? // Final?
var decorate = function(part, context) var decorate = function(part, context) {
{ macro("cutonfold", {
macro('cutonfold', { from: points.cbNeck,
from: points.cbNeck to: points.cbHips,
, to: points.cbHips grainline: true
, grainline: true
}); });
} };
if(final) { if (final) {
decorate(part, context); decorate(part, context);
} }
// Paperless? // Paperless?
var gauge = function(part, context) { var gauge = function(part, context) {};
}
if(paperless) { if (paperless) {
gauge(part, context); gauge(part, context);
} }
} }
} };
export default back; export default back;

View file

@ -1,46 +1,100 @@
import * as F from 'freesewing' import * as F from "freesewing";
var base = var base = {
{ draft: function(part, context) {
draft: function(part, context) let { measurements, options, points, paths, snippets } = F.utils.shorthand(
{ part,
context
let { measurements, options, points, paths, snippets } = F.utils.shorthand(part, context); );
// Center back (cb) vertical axis // Center back (cb) vertical axis
points.cbNeck = new F.point(0, options.backNeckCutout); points.cbNeck = new F.point(0, options.backNeckCutout);
points.cbShoulder = new F.point(0, ( measurements.shoulderSlope - options.shoulderSlopeReduction ) / 2); points.cbShoulder = new F.point(
points.cbArmhole = new F.point(0, points.cbShoulder.y + (measurements.bicepsCircumference + options.bicepsEase) * options.armholeDepthFactor); 0,
points.cbWaist = new F.point(0, measurements.centerBackNeckToWaist + options.backNeckCutout); (measurements.shoulderSlope - options.shoulderSlopeReduction) / 2
points.cbHips = new F.point(0, points.cbWaist.y + measurements.naturalWaistToHip); );
points.cbArmhole = new F.point(
0,
points.cbShoulder.y +
(measurements.bicepsCircumference + options.bicepsEase) *
options.armholeDepthFactor
);
points.cbWaist = new F.point(
0,
measurements.centerBackNeckToWaist + options.backNeckCutout
);
points.cbHips = new F.point(
0,
points.cbWaist.y + measurements.naturalWaistToHip
);
// Side back (cb) vertical axis // Side back (cb) vertical axis
points.armhole = new F.point(measurements.chestCircumference / 4 + options.chestEase / 4, points.cbArmhole.y); points.armhole = new F.point(
measurements.chestCircumference / 4 + options.chestEase / 4,
points.cbArmhole.y
);
points.waist = new F.point(points.armhole.x, points.cbWaist.y); points.waist = new F.point(points.armhole.x, points.cbWaist.y);
points.hips = new F.point(points.armhole.x, points.cbHips.y); points.hips = new F.point(points.armhole.x, points.cbHips.y);
// Shoulder line // Shoulder line
points.neck = new F.point(measurements.neckCircumference / options.collarFactor, 0); points.neck = new F.point(
points.shoulder = new F.point(measurements.shoulderToShoulder / 2 + options.shoulderEase / 2, points.cbShoulder.y); measurements.neckCircumference / options.collarFactor,
0
);
points.shoulder = new F.point(
measurements.shoulderToShoulder / 2 + options.shoulderEase / 2,
points.cbShoulder.y
);
// Armhhole // Armhhole
points.armholePitch = new F.point(measurements.shoulderToShoulder * options.acrossBackFactor / 2, points.shoulder.y + points.shoulder.dy(points.armhole)/2); points.armholePitch = new F.point(
(measurements.shoulderToShoulder * options.acrossBackFactor) / 2,
points.shoulder.y + points.shoulder.dy(points.armhole) / 2
);
points._tmp1 = new F.point(points.armholePitch.x, points.armhole.y); points._tmp1 = new F.point(points.armholePitch.x, points.armhole.y);
points._tmp2 = points._tmp1.shift(45, 10); points._tmp2 = points._tmp1.shift(45, 10);
points._tmp3 = F.utils.beamsCross(points._tmp1, points._tmp2, points.armhole, points.armholePitch); points._tmp3 = F.utils.beamsCross(
points._tmp1,
points._tmp2,
points.armhole,
points.armholePitch
);
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5); points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5);
points.armholeCp1 = points.armhole.shift(180, points._tmp1.dx(points.armhole)/4); points.armholeCp1 = points.armhole.shift(
points.armholeCp2 = points.armholeHollow.shift(-45, points.armholeHollow.dy(points.armhole)/2); 180,
points.armholeHollowCp1 = points.armholeHollow.shift(135, points.armholePitch.dx(points.armholeHollow)); points._tmp1.dx(points.armhole) / 4
points.armholeHollowCp2 = points.armholePitch.shift(-90, points.armholePitch.dy(points.armholeHollow)/2); );
points.armholePitchCp1 = points.armholePitch.shift(90, points.shoulder.dy(points.armholePitch)/2); points.armholeCp2 = points.armholeHollow.shift(
points.armholePitchCp2 = points.shoulder.shiftTowards(points.neck, points.shoulder.dy(points.armholePitch)/5).rotate(90, points.shoulder); -45,
points.armholeHollow.dy(points.armhole) / 2
);
points.armholeHollowCp1 = points.armholeHollow.shift(
135,
points.armholePitch.dx(points.armholeHollow)
);
points.armholeHollowCp2 = points.armholePitch.shift(
-90,
points.armholePitch.dy(points.armholeHollow) / 2
);
points.armholePitchCp1 = points.armholePitch.shift(
90,
points.shoulder.dy(points.armholePitch) / 2
);
points.armholePitchCp2 = points.shoulder
.shiftTowards(points.neck, points.shoulder.dy(points.armholePitch) / 5)
.rotate(90, points.shoulder);
// Neck opening // Neck opening
points._tmp4 = points.neck.shiftTowards(points.shoulder, 10).rotate(-90, points.neck); points._tmp4 = points.neck
points.neckCp1 = F.utils.beamCrossesY(points.neck, points._tmp4, points.cbNeck.y); .shiftTowards(points.shoulder, 10)
points.neckCp2 = points.cbNeck.shift(0, points.cbNeck.dx(points.neck)/2); .rotate(-90, points.neck);
points.neckCp1 = F.utils.beamCrossesY(
points.neck,
points._tmp4,
points.cbNeck.y
);
points.neckCp2 = points.cbNeck.shift(0, points.cbNeck.dx(points.neck) / 2);
} }
} };
export default base; export default base;

View file

@ -1,19 +1,17 @@
import * as freesewing from 'freesewing' import * as freesewing from "freesewing";
import * as cutonfold from '@freesewing-plugins/macro-cutonfold' import * as cutonfold from "@freesewing-plugins/macro-cutonfold";
import { config } from '../config/config' import { config } from "../config/config";
import back from './back' import back from "./back";
import { version } from "../package.json" import { version } from "../package.json";
console.log('config', config); console.log("config", config);
var brian = new freesewing.pattern(config) var brian = new freesewing.pattern(config).withPlugin(cutonfold);
.withPlugin(cutonfold);
brian.draft = function() brian.draft = function() {
{
back.draft(brian.parts.back, brian.context); back.draft(brian.parts.back, brian.context);
return brian; return brian;
} };
brian.version = version; brian.version = version;