1
0
Fork 0

construction: Moved to JS with babel transpiler

This commit is contained in:
Joost De Cock 2018-07-15 17:13:52 +02:00
parent b8eb8d5ab8
commit 945d3fd34c
13 changed files with 153 additions and 205 deletions

View file

@ -0,0 +1,49 @@
import F from 'freesewing'
import { Pattern } from 'freesewing/dist/lib/pattern'
var backBlock = {
draft: function(pattern, final = true) {
// Save some typing
let measurements = pattern.settings.measurements || {};
let options = pattern.options;
let values = pattern.values;
let points = pattern.parts.backBlock.points;
let paths = pattern.parts.backBlock.paths;
// Center back (cb) vertical axis
points.cbNeck = new F.point(0, options.backNeckCutout);
points.cbShoulder = new F.point(0, points.cbNeck.y + ( measurements.shoulderSlope - options.shoulderSlopeReduction ) / 2);
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
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.hips = new F.point(points.armhole.x, points.cbHips.y);
// Shoulder line
points.neck = new F.point(measurements.neckCircumference / options.collarFactor, 0);
points.shoulder = new F.point(measurements.shoulderToShoulder / 2 + options.shoulderEase / 2, points.cbShoulder.y);
// Armhhole
points.armholePitch = new F.point(measurements.shoulderToShoulder * options.acrossBackFactor / 2, points.armhole.y / 2 - points.shoulder.y / 2);
points._tmp1 = new F.point(points.armholePitch.x, points.armhole.y);
points._tmp2 = points._tmp1.shift(45, 10);
points._tmp3 = F.utils.beamsCross(points._tmp1, points._tmp2, points.armhole, points.armholePitch);
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5);
paths.test = new F.path()
.move(points.cbNeck)
.line(points.armhole)
.line(points.cbHips)
.line(points.hips)
.curve(points.neck, points.shoulder, points.armholePitch)
;
points.gridAnchor = points.cbHips;
}
}
export default backBlock;

View file

@ -0,0 +1,29 @@
import F from 'freesewing'
import * as patternConfig from '../config/config'
import { Pattern } from 'freesewing/dist/lib/pattern'
import backBlock from './lib/back'
import { manSize38 } from '@freesewing/models'
var brian = new F.pattern(patternConfig);
brian.draft = function(final = true) {
backBlock.draft(brian, final);
return brian;
}
export default brian;
// This is not for inclusion in production
console.log(manSize38);
brian.settings.measurements = manSize38;
brian.draft();
console.log(brian.parts.backBlock.points);