1
0
Fork 0

🚨 Removed linter warnings

This commit is contained in:
Joost De Cock 2019-05-10 13:14:31 +02:00
parent 14d8f75929
commit 803e1c0552
138 changed files with 1591 additions and 1250 deletions

View file

@ -1,8 +1,20 @@
import { dimensions } from './shared';
import { dimensions } from "./shared";
export default function(part) {
// prettier-ignore
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, complete, paperless, macro, utils, units} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
options,
complete,
paperless,
macro,
utils,
units
} = part.shorthand();
points.strapLeftCp2 = utils.beamsIntersect(
points.strapLeft,
@ -11,8 +23,14 @@ export default function(part) {
points.cbNeck.shift(0, 10)
);
points.armholeCp2 = points.aaronArmhole.shiftFractionTowards(points.armholeCorner, options.backlineBend);
points.strapRightCp1 = points.strapRight.shiftFractionTowards(points.armholeCorner, options.backlineBend);
points.armholeCp2 = points.aaronArmhole.shiftFractionTowards(
points.armholeCorner,
options.backlineBend
);
points.strapRightCp1 = points.strapRight.shiftFractionTowards(
points.armholeCorner,
options.backlineBend
);
// Seamline
paths.seam = new Path()
@ -29,35 +47,40 @@ export default function(part) {
// Complete pattern?
if (complete) {
let neckOpeningLength = new Path()
let neckOpeningLength =
new Path()
.move(points.strapLeft)
.curve(points.strapLeftCp2, points.cbNeck, points.cbNeck)
.length() + store.get('frontNeckOpeningLength');
let armholeLength = new Path()
.length() + store.get("frontNeckOpeningLength");
let armholeLength =
new Path()
.move(points.aaronArmhole)
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
.length() + store.get('frontArmholeLength');
points.bindinAnchor = new Point(points.aaronArmhole.x / 4, points.aaronArmhole.y)
.attr('data-text', 'cutTwoStripsToFinishTheArmholes')
.attr('data-text', ":\n")
.attr('data-text', "width")
.attr('data-text', ":")
.attr('data-text', units(sa*6))
.attr('data-text', "\n")
.attr('data-text', "length")
.attr('data-text', ":")
.attr('data-text', units(armholeLength * 0.95 + 2*sa))
.attr('data-text', "\n \n")
.attr('data-text', 'cutOneStripToFinishTheNeckOpening')
.attr('data-text', ":\n")
.attr('data-text', "width")
.attr('data-text', ":")
.attr('data-text', units(sa*6))
.attr('data-text', "\n")
.attr('data-text', "length")
.attr('data-text', ":")
.attr('data-text', units(neckOpeningLength * 0.95 + 2*sa))
.attr('data-text-lineheight', 6);
.length() + store.get("frontArmholeLength");
points.bindinAnchor = new Point(
points.aaronArmhole.x / 4,
points.aaronArmhole.y
)
.attr("data-text", "cutTwoStripsToFinishTheArmholes")
.attr("data-text", ":\n")
.attr("data-text", "width")
.attr("data-text", ":")
.attr("data-text", units(sa * 6))
.attr("data-text", "\n")
.attr("data-text", "length")
.attr("data-text", ":")
.attr("data-text", units(armholeLength * 0.95 + 2 * sa))
.attr("data-text", "\n \n")
.attr("data-text", "cutOneStripToFinishTheNeckOpening")
.attr("data-text", ":\n")
.attr("data-text", "width")
.attr("data-text", ":")
.attr("data-text", units(sa * 6))
.attr("data-text", "\n")
.attr("data-text", "length")
.attr("data-text", ":")
.attr("data-text", units(neckOpeningLength * 0.95 + 2 * sa))
.attr("data-text-lineheight", 6);
macro("cutonfold", {
from: points.cfNeck,
@ -81,4 +104,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,8 +1,22 @@
import { dimensions } from './shared';
import { dimensions } from "./shared";
export default function(part) {
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro} = part.shorthand();
let {
utils,
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro
} = part.shorthand();
// Hide Brian paths
for (let key of Object.keys(paths)) paths[key].render = false;
@ -12,21 +26,26 @@ export default function(part) {
// Rename cb (center back) to cf (center front)
for (let key of ["Neck", "Shoulder", "Armhole", "Waist", "Hips", "Hem"]) {
points[`cf${key}`] = new Point(
points[`cb${key}`].x,
points[`cb${key}`].y
);
points[`cf${key}`] = new Point(points[`cb${key}`].x, points[`cb${key}`].y);
//delete points[`cb${key}`];
}
// Neckline
points.cfNeck = points.cfNeck.shift(-90, options.necklineDrop *
points.cfNeck = points.cfNeck.shift(
-90,
options.necklineDrop *
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip)
);
// Strap
points.strapCenter = points.neck.shiftFractionTowards(points.shoulder, options.shoulderStrapPlacement);
points.strapLeft = points.strapCenter.shiftTowards(points.neck, points.neck.dist(points.shoulder) * options.shoulderStrapWidth);
points.strapCenter = points.neck.shiftFractionTowards(
points.shoulder,
options.shoulderStrapPlacement
);
points.strapLeft = points.strapCenter.shiftTowards(
points.neck,
points.neck.dist(points.shoulder) * options.shoulderStrapWidth
);
points.strapRight = points.strapLeft.rotate(180, points.strapCenter);
points.necklineCorner = utils.beamsIntersect(
points.strapLeft,
@ -34,11 +53,21 @@ export default function(part) {
points.cfNeck.shift(0, points.armholePitch.x / 4),
points.cfNeck
);
points.strapLeftCp2 = points.strapLeft.shiftFractionTowards(points.necklineCorner, options.necklineBend);
points.cfNeckCp1 = points.cfNeck.shiftFractionTowards(points.necklineCorner, options.necklineBend);
points.strapLeftCp2 = points.strapLeft.shiftFractionTowards(
points.necklineCorner,
options.necklineBend
);
points.cfNeckCp1 = points.cfNeck.shiftFractionTowards(
points.necklineCorner,
options.necklineBend
);
// Hips
points.hips.x = (measurements.hipsCircumference + (options.hipsEase * measurements.hipsCircumference))/4 * (1 - options.stretchFactor);
points.hips.x =
((measurements.hipsCircumference +
options.hipsEase * measurements.hipsCircumference) /
4) *
(1 - options.stretchFactor);
points.waist.x = points.hips.x; // Because stretch
points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist) / 2);
@ -50,7 +79,9 @@ export default function(part) {
.move(points.hem)
.line(points.waist)
.curve(points.waistCp2, points.armhole, points.armhole);
let split = side.intersectsY(points.armhole.y * (1 + options.armholeDrop)).pop();
let split = side
.intersectsY(points.armhole.y * (1 + options.armholeDrop))
.pop();
paths.side = side.split(split)[0];
paths.side.render = false;
points.aaronArmhole = split;
@ -62,8 +93,14 @@ export default function(part) {
points.strapRight,
points.strapLeft.rotate(90, points.strapRight)
);
points.armholeCp2 = points.aaronArmhole.shiftFractionTowards(points.armholeCorner, 0.8);
points.strapRightCp1 = points.strapRight.shiftFractionTowards(points.armholeCorner, 0.6);
points.armholeCp2 = points.aaronArmhole.shiftFractionTowards(
points.armholeCorner,
0.8
);
points.strapRightCp1 = points.strapRight.shiftFractionTowards(
points.armholeCorner,
0.6
);
// Seamline
paths.seam = new Path()
@ -80,14 +117,14 @@ export default function(part) {
// Store length of armhole and neck opening
store.set(
'frontArmholeLength',
"frontArmholeLength",
new Path()
.move(points.aaronArmhole)
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
.length()
);
store.set(
'frontNeckOpeningLength',
"frontNeckOpeningLength",
new Path()
.move(points.strapLeft)
.curve(points.cfNeckCp1, points.cfNeckCp1, points.cfNeck)
@ -113,9 +150,7 @@ export default function(part) {
.offset(sa)
.line(points.strapLeft)
.attr("class", "fabric sa");
paths.saShoulder
.move(points.strapRight)
.line(paths.saShoulder.start());
paths.saShoulder.move(points.strapRight).line(paths.saShoulder.start());
paths.saSide = paths.side
.offset(sa)
.line(points.aaronArmhole)
@ -123,11 +158,10 @@ export default function(part) {
paths.saHem = new Path()
.move(points.cfHem)
.line(points.hem)
.offset(sa * 2.5).attr("class", "fabric sa")
.offset(sa * 2.5)
.attr("class", "fabric sa")
.line(paths.saSide.start());
paths.saHem
.move(points.cfHem)
.line(paths.saHem.start());
paths.saHem.move(points.cfHem).line(paths.saHem.start());
}
}
@ -142,4 +176,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,5 +1,5 @@
export default function(part, s) {
let { macro, Point, Path, points, paths, complete, paperless, snippets, Snippet, sa } = part.shorthand();
let { macro, points, sa } = part.shorthand();
macro("ld", {
from: points[s + "WristLeft"],
@ -50,4 +50,3 @@ export default function(part, s) {
x: points[s + "LeftEdge"].x - sa - 45
});
}

View file

@ -1,14 +1,28 @@
export default function(part) {
let { Point, Path, points, paths, store, options, measurements,utils } = part.shorthand();
// FIXME: simplify points names a bit, they're too long
let { Path, points, store, options } = part.shorthand();
function draftSleeve(part, tweak) {
let { Point, Path, points, paths, store, options, measurements,utils } = part.shorthand();
let {
Point,
Path,
points,
paths,
store,
options,
measurements,
utils
} = part.shorthand();
// Sleeve frame
points.top = new Point(0, 0);
points.boxTopRight = points.top.shift(0, store.get("sleevecapTarget") / 5.8 * tweak);
points.boxTopRight = points.top.shift(
0,
(store.get("sleevecapTarget") / 5.8) * tweak
);
points.boxTopLeft = points.boxTopRight.flipX();
points.boxBottom = points.top.shift(-90, measurements.shoulderToWrist * (1 + options.sleeveLengthBonus));
points.boxBottom = points.top.shift(
-90,
measurements.shoulderToWrist * (1 + options.sleeveLengthBonus)
);
points.boxBottomRight = points.boxBottom.shift(0, points.boxTopRight.x);
points.boxBottomLeft = points.boxBottomRight.flipX();
points.armCenter = points.top.shift(
@ -34,7 +48,10 @@ export default function(part) {
points.usLeftEdge = points.armLeft.shift(0, factor / 4);
points.tsRightEdge = points.armRight.shift(0, factor / 9);
points.usRightEdge = points.armRight.shift(180, factor / 9);
points.frontPitchPoint = new Point(points.boxTopLeft.x, points.armCenter.y * 0.6);
points.frontPitchPoint = new Point(
points.boxTopLeft.x,
points.armCenter.y * 0.6
);
points.tsElbowLeft = points.elbowLeft.shift(180, factor / 9);
points.usElbowLeft = points.elbowLeft.shift(0, factor / 2.4);
@ -51,29 +68,77 @@ export default function(part) {
let wristWidth = measurements.wristCircumference * (1 + options.cuffEase);
let topWrist = wristWidth / 2 + factor / 5;
let underWrist = wristWidth / 2 - factor / 5;
points.tsWristLeftHelperBottom = points.tsWristRight.shift(180, topWrist/2);
points.usWristLeftHelperBottom = points.usWristRight.shift(180, underWrist/2);
points.tsWristLeftHelperTop = points.tsElbowLeft.shiftFractionTowards(points.elbowRight, 0.5)
points.usWristLeftHelperTop = points.usElbowLeft.shiftFractionTowards(points.elbowRight, 0.5)
let tsWristAngle = points.tsWristLeftHelperBottom.angle(points.tsWristLeftHelperTop);
let usWristAngle = points.usWristLeftHelperBottom.angle(points.usWristLeftHelperTop);
points.tsWristLeft = points.tsWristRight.shift(tsWristAngle - 90, topWrist * -1);
points.usWristLeft = points.usWristRight.shift(usWristAngle - 90, underWrist * -1);
points.tsWristLeftHelperBottom = points.tsWristRight.shift(
180,
topWrist / 2
);
points.usWristLeftHelperBottom = points.usWristRight.shift(
180,
underWrist / 2
);
points.tsWristLeftHelperTop = points.tsElbowLeft.shiftFractionTowards(
points.elbowRight,
0.5
);
points.usWristLeftHelperTop = points.usElbowLeft.shiftFractionTowards(
points.elbowRight,
0.5
);
let tsWristAngle = points.tsWristLeftHelperBottom.angle(
points.tsWristLeftHelperTop
);
let usWristAngle = points.usWristLeftHelperBottom.angle(
points.usWristLeftHelperTop
);
points.tsWristLeft = points.tsWristRight.shift(
tsWristAngle - 90,
topWrist * -1
);
points.usWristLeft = points.usWristRight.shift(
usWristAngle - 90,
underWrist * -1
);
// Control points ts
points.tsRightEdgeCpTop = points.tsRightEdge.shift(90, points.backPitchPoint.dy(points.tsRightEdge)/2);
points.tsRightEdgeCpBottom = points.tsRightEdgeCpTop.flipY(points.tsRightEdge);
points.elbowRightCpTop = points.tsWristRight.shiftFractionTowards(points.elbowRight, 1.15);
points.tsRightEdgeCpTop = points.tsRightEdge.shift(
90,
points.backPitchPoint.dy(points.tsRightEdge) / 2
);
points.tsRightEdgeCpBottom = points.tsRightEdgeCpTop.flipY(
points.tsRightEdge
);
points.elbowRightCpTop = points.tsWristRight.shiftFractionTowards(
points.elbowRight,
1.15
);
points.topCpRight = points.top.shift(0, factor / 1.6);
points.topCpLeft = points.topCpRight.flipX();
points.tsLeftEdgeCpRight = points.tsLeftEdge.shift(0, points.tsLeftEdge.dist(points.armLeft)/2);
points.frontPitchPointCpBottom = points.frontPitchPoint.shiftFractionTowards(points.tsLeftEdgeCpRight, 0.666);
points.frontPitchPointCpTop = points.frontPitchPointCpBottom.rotate(180, points.frontPitchPoint);
points.tsElbowLeftCpTop = points.tsWristLeft.shiftFractionTowards(points.tsElbowLeft, 1.2);
points.tsLeftEdgeCpRight = points.tsLeftEdge.shift(
0,
points.tsLeftEdge.dist(points.armLeft) / 2
);
points.frontPitchPointCpBottom = points.frontPitchPoint.shiftFractionTowards(
points.tsLeftEdgeCpRight,
0.666
);
points.frontPitchPointCpTop = points.frontPitchPointCpBottom.rotate(
180,
points.frontPitchPoint
);
points.tsElbowLeftCpTop = points.tsWristLeft.shiftFractionTowards(
points.tsElbowLeft,
1.2
);
// Control points us
points.usRightEdgeCpBottom = points.usRightEdge.shift(points.usTip.angle(points.elbowRight), points.usTip.dy(points.usRightEdge)/2);
points.usRightEdgeCpTop = points.usRightEdgeCpBottom.rotate(180, points.usRightEdge);
points.usRightEdgeCpBottom = points.usRightEdge.shift(
points.usTip.angle(points.elbowRight),
points.usTip.dy(points.usRightEdge) / 2
);
points.usRightEdgeCpTop = points.usRightEdgeCpBottom.rotate(
180,
points.usRightEdge
);
points._helper1 = new Path()
.move(points.backPitchPoint)
._curve(points.topCpRight, points.top)
@ -82,24 +147,50 @@ export default function(part) {
.move(points.backPitchPoint)
._curve(points.tsRightEdgeCpTop, points.tsRightEdge)
.shiftAlong(5);
points.usLeftEdgeRight = points.usLeftEdge.shift(0, points.usLeftEdge.dist(points.armCenter)/3);
points.usLeftEdgeCpRight = points.usLeftEdge.shift(0, points.usLeftEdge.dist(points.armCenter)/1.2);
points.usLeftEdgeRight = points.usLeftEdge.shift(
0,
points.usLeftEdge.dist(points.armCenter) / 3
);
points.usLeftEdgeCpRight = points.usLeftEdge.shift(
0,
points.usLeftEdge.dist(points.armCenter) / 1.2
);
// Angle of the usTip
let angle = points._helper1.angle(points.backPitchPoint) - points.backPitchPoint.angle(points._helper2);
points.usTipCpBottom = points.usRightEdgeCpTop.rotate(angle * -1, points.usTip)
points.usElbowLeftCpTop = points.usWristLeft.shiftFractionTowards(points.usElbowLeft, 1.2);
let angle =
points._helper1.angle(points.backPitchPoint) -
points.backPitchPoint.angle(points._helper2);
points.usTipCpBottom = points.usRightEdgeCpTop.rotate(
angle * -1,
points.usTip
);
points.usElbowLeftCpTop = points.usWristLeft.shiftFractionTowards(
points.usElbowLeft,
1.2
);
// Calculate length of the sleevecap seam
let lenTop = new Path()
.move(points.backPitchPoint)
.curve(points.backPitchPoint, points.topCpRight, points.top)
.curve(points.topCpLeft, points.frontPitchPointCpTop, points.frontPitchPoint)
.curve(points.frontPitchPointCpBottom, points.tsLeftEdgeCpRight, points.tsLeftEdge)
.curve(
points.topCpLeft,
points.frontPitchPointCpTop,
points.frontPitchPoint
)
.curve(
points.frontPitchPointCpBottom,
points.tsLeftEdgeCpRight,
points.tsLeftEdge
)
.length();
let lenUnder = new Path()
.move(points.usTip)
.curve(points.usTipCpBottom, points.usLeftEdgeCpRight, points.usLeftEdgeRight)
.curve(
points.usTipCpBottom,
points.usLeftEdgeCpRight,
points.usLeftEdgeRight
)
.line(points.usLeftEdge)
.length();
store.set("sleevecapLength", lenTop + lenUnder);
@ -123,16 +214,27 @@ export default function(part) {
else tweak = tweak * 1.02;
} while (Math.abs(delta) > 2 && runs < 25);
// Paths
paths.ts = new Path()
.move(points.tsWristRight)
.line(points.elbowRight)
.curve(points.elbowRightCpTop, points.tsRightEdgeCpBottom, points.tsRightEdge)
.curve(
points.elbowRightCpTop,
points.tsRightEdgeCpBottom,
points.tsRightEdge
)
.curve_(points.tsRightEdgeCpTop, points.backPitchPoint)
.curve(points.backPitchPoint, points.topCpRight, points.top)
.curve(points.topCpLeft, points.frontPitchPointCpTop, points.frontPitchPoint)
.curve(points.frontPitchPointCpBottom, points.tsLeftEdgeCpRight, points.tsLeftEdge)
.curve(
points.topCpLeft,
points.frontPitchPointCpTop,
points.frontPitchPoint
)
.curve(
points.frontPitchPointCpBottom,
points.tsLeftEdgeCpRight,
points.tsLeftEdge
)
.curve(points.tsLeftEdge, points.tsElbowLeftCpTop, points.tsElbowLeft)
.line(points.tsWristLeft)
.line(points.tsWristRight)
@ -142,9 +244,17 @@ export default function(part) {
paths.us = new Path()
.move(points.usWristRight)
.line(points.elbowRight)
.curve(points.elbowRightCpTop, points.usRightEdgeCpBottom, points.usRightEdge)
.curve(
points.elbowRightCpTop,
points.usRightEdgeCpBottom,
points.usRightEdge
)
.curve_(points.usRightEdgeCpTop, points.usTip)
.curve(points.usTipCpBottom, points.usLeftEdgeCpRight, points.usLeftEdgeRight)
.curve(
points.usTipCpBottom,
points.usLeftEdgeCpRight,
points.usLeftEdgeRight
)
.line(points.usLeftEdge)
.curve(points.usLeftEdge, points.usElbowLeftCpTop, points.usElbowLeft)
.line(points.usWristLeft)

View file

@ -1,13 +1,21 @@
import dimensions from "./shared";
export default function(part) {
let { macro, Point, Path, points, paths, complete, paperless, snippets, Snippet, sa } = part.shorthand();
let {
macro,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa
} = part.shorthand();
// Extract seamline from sleeve
delete paths.us;
paths.seam = paths.ts
.clone()
.attr("class", "fabric", true);
paths.seam = paths.ts.clone().attr("class", "fabric", true);
delete paths.ts;
// Complete?
@ -25,7 +33,8 @@ export default function(part) {
paths.sa.ops.splice(-2);
paths.sa = paths.sa
.offset(sa)
.join(new Path()
.join(
new Path()
.move(points.tsWristLeft)
.line(points.tsWristRight)
.offset(sa * 3)
@ -33,7 +42,6 @@ export default function(part) {
.close()
.attr("class", "fabric sa");
}
}
// Paperless?

View file

@ -1,13 +1,21 @@
import dimensions from "./shared";
export default function(part) {
let { macro, Point, Path, points, paths, complete, paperless, snippets, Snippet, sa } = part.shorthand();
let {
macro,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa
} = part.shorthand();
// Extract seamline from sleeve
delete paths.ts;
paths.seam = paths.us
.clone()
.attr("class", "fabric", true);
paths.seam = paths.us.clone().attr("class", "fabric", true);
delete paths.us;
// Complete?
@ -25,7 +33,8 @@ export default function(part) {
paths.sa.ops.splice(-2);
paths.sa = paths.sa
.offset(sa)
.join(new Path()
.join(
new Path()
.move(points.usWristLeft)
.line(points.usWristRight)
.offset(sa * 3)
@ -33,7 +42,6 @@ export default function(part) {
.close()
.attr("class", "fabric sa");
}
}
// Paperless?

View file

@ -1,8 +1,18 @@
import * as shared from "./shared";
export default part => {
// prettier-ignore
let {store, sa, points, Path, paths, Snippet, snippets, complete, paperless, macro} = part.shorthand();
let {
store,
sa,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro
} = part.shorthand();
// Seamline
paths.saBase = shared.saBase("back", points, Path);

View file

@ -1,8 +1,21 @@
import * as shared from "./shared";
export default part => {
// prettier-ignore
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro
} = part.shorthand();
// Cut arm a bit deeper at the front
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;

View file

@ -1,6 +1,21 @@
export default part => {
// prettier-ignore
let {debug, store, units, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro} = part.shorthand();
let {
debug,
store,
units,
sa,
measurements,
options,
Point,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro
} = part.shorthand();
// Wrist
let top = paths.sleevecap.bbox().topLeft.y;

View file

@ -14,8 +14,17 @@ function sleevecapAdjust(store) {
}
function draftSleevecap(part, run) {
// prettier-ignore
let {debug, units, store, measurements, options, Point, points, Path, paths} = part.shorthand();
let {
debug,
units,
store,
measurements,
options,
Point,
points,
Path,
paths
} = part.shorthand();
// Sleeve center axis
points.centerBiceps = new Point(0, 0);
points.centerCap = points.centerBiceps.shift(
@ -156,7 +165,6 @@ function draftSleevecap(part, run) {
}
export default part => {
// prettier-ignore
let { debug, store, units, options, Point, points, paths } = part.shorthand();
store.set("sleeveFactor", 1);

View file

@ -1,41 +1,66 @@
import init from "./init";
export default function(part) {
// prettier-ignore
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, utils} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro,
utils
} = part.shorthand();
// Initialize
init(part);
// Center back
points.zero = new Point(0, 0);
points.center = points.zero.shift(90, store.get('rise'));
points.center = points.zero.shift(90, store.get("rise"));
// Side top
points.sideRight = new Point(store.get('hipsBack') / 2, points.center.y);
points.sideRight = new Point(store.get("hipsBack") / 2, points.center.y);
// Gusset
points.gussetTop = points.center.shift(-90, store.get('riseLength'));
points.gussetBottom = points.gussetTop.shift(-90, store.get('gusset') + store.get('legBonus'));
points.gussetRight = points.gussetBottom.shift(0, store.get('gusset') * store.get('xScale') / 2);
points.gussetTop = points.center.shift(-90, store.get("riseLength"));
points.gussetBottom = points.gussetTop.shift(
-90,
store.get("gusset") + store.get("legBonus")
);
points.gussetRight = points.gussetBottom.shift(
0,
(store.get("gusset") * store.get("xScale")) / 2
);
points.gussetCpRight = new Point(points.gussetRight.x, points.gussetTop.y);
// Find leg edge
let isect = utils.circlesIntersect(points.gussetRight, store.get('legBack'), points.sideRight, store.get('fullLength'));
let isect = utils.circlesIntersect(
points.gussetRight,
store.get("legBack"),
points.sideRight,
store.get("fullLength")
);
points.legRight = isect[1];
points.legLeft = points.legRight.flipX(points.center);
// Store back seam length and (half of the) crotch seam length
store.set('backSeamLength', points.sideRight.dist(points.legRight));
store.set('crotchSeamLength', new Path()
store.set("backSeamLength", points.sideRight.dist(points.legRight));
store.set(
"crotchSeamLength",
new Path()
.move(points.gussetTop)
.curve(points.gussetCpRight, points.gussetRight, points.gussetRight)
.length()
);
// Handle back rise
points.center = points.center.shift(90, store.get('backRise'));
points.sideRight = points.sideRight.shift(90, store.get('sideRise'));
points.center = points.center.shift(90, store.get("backRise"));
points.sideRight = points.sideRight.shift(90, store.get("sideRise"));
points.centerCpRight = new Point(points.sideRight.x / 2, points.center.y);
points.centerCpLeft = points.centerCpRight.flipX();
@ -47,7 +72,7 @@ export default function(part) {
.curve(points.sideRight, points.centerCpRight, points.center)
.line(points.gussetTop)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
// Complete pattern?
if (complete) {
@ -60,11 +85,11 @@ export default function(part) {
let sa2 = new Path()
.move(points.gussetTop)
.curve(points.gussetCpRight, points.gussetRight, points.gussetRight)
.offset(sa)
.offset(sa);
let hemSa = new Path()
.move(points.gussetRight)
.line(points.legRight)
.offset(sa * 2)
.offset(sa * 2);
paths.sa = new Path()
.move(points.gussetTop)
.line(sa2.start())
@ -72,63 +97,63 @@ export default function(part) {
.join(hemSa)
.join(sa1)
.line(points.center)
.attr('class', 'fabric sa');
.attr("class", "fabric sa");
}
points.title = new Point(points.sideRight.x * 0.6, points.gussetTop.y * 0.6);
macro('title', {
points.title = new Point(
points.sideRight.x * 0.6,
points.gussetTop.y * 0.6
);
macro("title", {
at: points.title,
nr: 1,
title: 'back'
title: "back"
});
macro('cutonfold', {
macro("cutonfold", {
from: points.center,
to: points.gussetTop,
grainline: true
});
snippets.logo = new Snippet(
'logo',
points.title.shift(90, 50)
);
snippets.logo = new Snippet("logo", points.title.shift(90, 50));
}
// Paperless?
if (paperless) {
macro('vd', {
macro("vd", {
from: points.gussetTop,
to: points.center,
x: points.center.x - 15
});
macro('vd', {
macro("vd", {
from: points.gussetRight,
to: points.center,
x: points.center.x - 30
});
macro('vd', {
macro("vd", {
from: points.legRight,
to: points.sideRight,
x: points.legRight.x + 15 + sa
});
macro('vd', {
macro("vd", {
from: points.legRight,
to: points.center,
x: points.legRight.x + 30 + sa
});
macro('hd', {
macro("hd", {
from: points.center,
to: points.sideRight,
y: points.center.y - 15 - sa
});
macro('hd', {
macro("hd", {
from: points.gussetTop,
to: points.gussetRight,
y: points.gussetRight.y + 15 + sa * 2
});
macro('hd', {
macro("hd", {
from: points.gussetTop,
to: points.legRight,
y: points.gussetRight.y + 30 + sa * 2
});
macro('ld', {
macro("ld", {
from: points.gussetRight,
to: points.legRight,
d: -15 - sa * 2
@ -136,4 +161,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,17 +1,21 @@
import init from "./init";
function tuskDelta(part) {
let {Path, points, store} = part.shorthand();
let { Path, points } = part.shorthand();
let len = new Path()
.move(points.midRight)
.curve(points.curveRightCpTop, points.curveRightCpBottom, points.rightTuskRight)
.curve(
points.curveRightCpTop,
points.curveRightCpBottom,
points.rightTuskRight
)
.length();
return len - store.get('curve');
return len - store.get("curve");
}
function tweakTusk(delta, part) {
let {Path, points, store} = part.shorthand();
let { points } = part.shorthand();
let factor;
if (Math.abs(delta) > 2) factor = 3;
@ -19,62 +23,108 @@ function tweakTusk(delta, part) {
points.rightTuskRight = points.rightTuskRight.shift(90, delta / factor);
points.rightTuskLeft = points.rightTuskLeft.shift(90, delta / factor);
points.curveRightCpBottom = points.curveRightCpBottom.shift(90, delta/factor);
points.curveRightCpBottom = points.curveRightCpBottom.shift(
90,
delta / factor
);
}
export default function(part) {
// prettier-ignore
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, utils, debug} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
options,
complete,
paperless,
macro,
utils,
debug
} = part.shorthand();
// Initialize
init(part);
points.topRight = new Point(store.get('hipsFront')/2, 0);
points.topRight = new Point(store.get("hipsFront") / 2, 0);
points.topLeft = points.topRight.flipX();
points.midMid = new Point(0, store.get('heightFront'));
points.midRight = new Point(points.topRight.x + store.get('heightFront') * 0.05, points.midMid.y);
points.midMid = new Point(0, store.get("heightFront"));
points.midRight = new Point(
points.topRight.x + store.get("heightFront") * 0.05,
points.midMid.y
);
points.midLeft = points.midRight.flipX();
// Store this length for a notch on the side part
store.set('frontNotch', points.topRight.dist(points.midRight));
store.set("frontNotch", points.topRight.dist(points.midRight));
points.bottomMid = new Point(0, store.get('riseLength'));
points.bottomMid = new Point(0, store.get("riseLength"));
points.rightTuskRight = new Point(
store.get('gusset') * store.get('xScale') * ( 1 - store.get('gussetInsetRatio') ),
store.get("gusset") *
store.get("xScale") *
(1 - store.get("gussetInsetRatio")),
points.bottomMid.y
);
points.rightTuskLeft = points.bottomMid.clone();
points.curveRightCpTop = new Point(points.midRight.x - store.get('gusset') * 1.3, points.midRight.y);
points.curveRightCpBottom = new Point(points.rightTuskRight.x, points.rightTuskRight.y - store.get('gusset')*1.3);
points.curveRightCpTop = new Point(
points.midRight.x - store.get("gusset") * 1.3,
points.midRight.y
);
points.curveRightCpBottom = new Point(
points.rightTuskRight.x,
points.rightTuskRight.y - store.get("gusset") * 1.3
);
// Adjust tusk length to fit inset curve
let delta = tuskDelta(part);
let count = 0;
while (Math.abs(delta) > 1) { // Below 1mm is good enough
while (Math.abs(delta) > 1) {
// Below 1mm is good enough
tweakTusk(delta, part);
delta = tuskDelta(part);
count++;
if(count>150) throw("We got stuck trying to calculate an optimal tusk length. Please report this.");
if (count > 150)
throw "We got stuck trying to calculate an optimal tusk length. Please report this.";
}
debug(`After ${count} iterations, tusk curve length is ${utils.round(delta)}mm off.`);
debug(
`After ${count} iterations, tusk curve length is ${utils.round(
delta
)}mm off.`
);
// Adjust midMid to new length
points.bottomMid = new Point(0, points.rightTuskLeft.y);
// Front dart only if bulge > 0
if (options.bulge > 0) {
// Rotate tusk according to bulge option
for (let pid of ['curveRightCpTop', 'curveRightCpBottom', 'rightTuskRight', 'rightTuskLeft']) {
for (let pid of [
"curveRightCpTop",
"curveRightCpBottom",
"rightTuskRight",
"rightTuskLeft"
]) {
points[pid] = points[pid].rotate(options.bulge, points.midRight);
}
// Dart join point
points.dartJoin = new Point(0, points.midMid.y + 0.65 * points.midMid.dist(points.bottomMid));
points.dartJoin = new Point(
0,
points.midMid.y + 0.65 * points.midMid.dist(points.bottomMid)
);
// Dart control point
points.dartCpRight = new Point(0, points.dartJoin.y + points.dartJoin.dist(points.bottomMid) * (options.bulge/30));
points.dartCpRight = points.dartCpRight.rotate(options.bulge, points.dartJoin);
points.dartCpRight = new Point(
0,
points.dartJoin.y +
points.dartJoin.dist(points.bottomMid) * (options.bulge / 30)
);
points.dartCpRight = points.dartCpRight.rotate(
options.bulge,
points.dartJoin
);
// Flip control point to left side
points.dartCpLeft = points.dartCpRight.flipX();
@ -90,8 +140,8 @@ export default function(part) {
// Handle back rise
points.topMid = new Point(0, points.topLeft.y);
points.topLeft = points.topLeft.shift(90, store.get('frontRise'));
points.topRight = points.topRight.shift(90, store.get('frontRise'));
points.topLeft = points.topLeft.shift(90, store.get("frontRise"));
points.topRight = points.topRight.shift(90, store.get("frontRise"));
points.topMidCpRight = new Point(points.topRight.x / 2, points.topMid.y);
points.topMidCpLeft = points.topMidCpRight.flipX();
@ -99,14 +149,18 @@ export default function(part) {
paths.trimBase = new Path()
.move(points.rightTuskLeft)
.curve(points.rightTuskLeft, points.dartCpRight, points.dartJoin)
.curve(points.dartCpLeft, points.leftTuskRight, points.leftTuskRight)
.curve(points.dartCpLeft, points.leftTuskRight, points.leftTuskRight);
paths.seamStart = new Path()
.move(points.midLeft)
.line(points.topLeft)
.curve(points.topLeft, points.topMidCpLeft, points.topMid)
.curve(points.topMidCpRight, points.topRight, points.topRight)
.line(points.midRight)
.curve(points.curveRightCpTop, points.curveRightCpBottom, points.rightTuskRight)
.curve(
points.curveRightCpTop,
points.curveRightCpBottom,
points.rightTuskRight
)
.line(points.rightTuskLeft);
paths.seamEnd = new Path()
.move(points.leftTuskRight)
@ -123,11 +177,15 @@ export default function(part) {
.curve(points.topLeft, points.topMidCpLeft, points.topMid)
.curve(points.topMidCpRight, points.topRight, points.topRight)
.line(points.midRight)
.curve(points.curveRightCpTop, points.curveRightCpBottom, points.rightTuskRight)
.curve(
points.curveRightCpTop,
points.curveRightCpBottom,
points.rightTuskRight
)
.line(points.leftTuskLeft)
.curve(points.curveLeftCpBottom, points.curveLeftCpTop, points.midLeft);
}
paths.seam.close().attr('class', 'fabric');
paths.seam.close().attr("class", "fabric");
// Complete pattern?
if (complete) {
@ -141,104 +199,110 @@ export default function(part) {
paths.sa = paths.seam.offset(sa * -1).trim();
}
}
macro('title', {
macro("title", {
at: points.midMid,
nr: 2,
title: 'front'
title: "front"
});
macro('grainline', {
macro("grainline", {
from: points.dartJoin,
to: points.topMid
});
}
// Paperless?
if (paperless) {
macro('hd', {
macro("hd", {
from: points.topLeft,
to: points.topRight,
y: points.topLeft.y - 15 - sa
});
macro('hd', {
macro("hd", {
from: points.midLeft,
to: points.midRight,
y: points.topLeft.y - 30 - sa
});
macro('vd', {
macro("vd", {
from: points.midLeft,
to: points.topMid,
x: points.midLeft.x - 15 - sa
});
macro('vd', {
macro("vd", {
from: points.midLeft,
to: points.topLeft,
x: points.midLeft.x - 30 - sa
});
if (options.bulge === 0) {
macro('hd', {
macro("hd", {
from: points.leftTuskLeft,
to: points.rightTuskRight,
y: points.leftTuskLeft.y + 15 + sa
});
macro('vd', {
macro("vd", {
from: points.leftTuskLeft,
to: points.topLeft,
x: points.midLeft.x - 45 - sa
});
} else {
macro('vd', {
macro("vd", {
from: points.leftTuskLeft,
to: points.topLeft,
x: points.midLeft.x - 45 - sa
});
macro('vd', {
macro("vd", {
from: points.leftTuskRight,
to: points.topLeft,
x: points.midLeft.x - 60 - sa
});
points.narrowRight = new Path()
.move(points.midRight)
.curve(points.curveRightCpTop, points.curveRightCpBottom, points.rightTuskRight)
.edge('left');
.curve(
points.curveRightCpTop,
points.curveRightCpBottom,
points.rightTuskRight
)
.edge("left");
points.narrowLeft = new Path()
.move(points.midLeft)
.curve(points.curveLeftCpTop, points.curveLeftCpBottom, points.leftTuskLeft)
.attr('class', 'various stroke-xl lashed')
.edge('right');
macro('hd', {
.curve(
points.curveLeftCpTop,
points.curveLeftCpBottom,
points.leftTuskLeft
)
.attr("class", "various stroke-xl lashed")
.edge("right");
macro("hd", {
from: points.narrowLeft,
to: points.narrowRight,
y: points.narrowLeft.y
});
macro('hd', {
macro("hd", {
from: points.leftTuskRight,
to: points.rightTuskLeft,
y: points.rightTuskLeft.y + 15 + sa
});
macro('hd', {
macro("hd", {
from: points.leftTuskLeft,
to: points.rightTuskRight,
y: points.rightTuskLeft.y + 30 + sa
});
macro('ld', {
macro("ld", {
from: points.rightTuskLeft,
to: points.rightTuskRight,
d: -15 - sa
});
macro('vd', {
macro("vd", {
from: points.narrowRight,
to: points.topRight,
x: points.topRight.x + 15 + sa
});
macro('vd', {
macro("vd", {
from: points.dartJoin,
to: points.topRight,
x: points.topRight.x + 30 + sa
});
}
}
return part;
};
}

View file

@ -1,26 +1,47 @@
import init from "./init";
export default function(part) {
// prettier-ignore
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, utils} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
measurements,
complete,
paperless,
macro
} = part.shorthand();
// Initialize
init(part);
// height is 73.5%
points.topLeft = new Point(0, 0);
points.bottomLeft = points.topLeft.shift(-90, store.get('heightInset'));
points.bottomRight = new Point(store.get('legInset'), points.bottomLeft.y);
points.tip = new Point(points.bottomRight.x * 1.111, points.bottomRight.y - store.get('gusset'));
points.bottomLeft = points.topLeft.shift(-90, store.get("heightInset"));
points.bottomRight = new Point(store.get("legInset"), points.bottomLeft.y);
points.tip = new Point(
points.bottomRight.x * 1.111,
points.bottomRight.y - store.get("gusset")
);
points.tip = points.bottomRight.shiftTowards(
points.tip,
store.get('crotchSeamLength') - store.get('gusset') * (1-store.get('gussetInsetRatio'))
store.get("crotchSeamLength") -
store.get("gusset") * (1 - store.get("gussetInsetRatio"))
);
points.tipCpTop = new Point(store.get("gusset") * 1.2, 0);
points.tipCpBottom = points.tip.shift(
points.bottomRight.angle(points.tip) + 90,
store.get("gusset") * 1.5
);
points.tipCpTop = new Point(store.get('gusset') * 1.2, 0);
points.tipCpBottom = points.tip.shift(points.bottomRight.angle(points.tip)+90, store.get('gusset') * 1.5);
// Store cuve length
store.set('curve', new Path()
store.set(
"curve",
new Path()
.move(points.tip)
.curve(points.tipCpBottom, points.tipCpTop, points.topLeft)
.length()
@ -34,41 +55,41 @@ export default function(part) {
.line(points.tip)
.curve(points.tipCpBottom, points.tipCpTop, points.topLeft)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
// Complete pattern?
if (complete) {
if(sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5);
macro('title', {
macro("title", {
at: points.title.shift(-90, 15),
nr: 4,
title: 'inset'
title: "inset"
});
macro('grainline', {
macro("grainline", {
from: points.bottomLeft.shift(0, 15),
to: points.topLeft.shift(0, 15),
to: points.topLeft.shift(0, 15)
});
}
// Paperless?
if (paperless) {
macro('vd', {
macro("vd", {
from: points.bottomLeft,
to: points.topLeft,
x: points.topLeft.x - 15 - sa
});
macro('vd', {
macro("vd", {
from: points.bottomRight,
to: points.tip,
x: points.tip.x + 15 + sa
});
macro('hd', {
macro("hd", {
from: points.bottomLeft,
to: points.bottomRight,
y: points.bottomRight.y + 15 + sa
});
macro('hd', {
macro("hd", {
from: points.bottomLeft,
to: points.tip,
y: points.bottomRight.y + 30 + sa
@ -76,4 +97,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,32 +1,47 @@
import init from "./init";
export default function(part) {
// prettier-ignore
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, utils} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
complete,
paperless,
macro,
utils
} = part.shorthand();
// Initialize
init(part);
// Top left
points.zero = new Point(0, 0);
points.topLeft = points.zero.shift(90, store.get('rise'));
points.topLeft = points.zero.shift(90, store.get("rise"));
// Top right
points.topRight = new Point(store.get('hipsSide'), points.topLeft.y);
points.topRight = new Point(store.get("hipsSide"), points.topLeft.y);
// Bottom right
points.bottomRight = points.topRight.shift(-90, store.get('fullLength'));
points.bottomRight = points.topRight.shift(-90, store.get("fullLength"));
// Find bottom left
let isect = utils.circlesIntersect(points.bottomRight, store.get('legSide'), points.topLeft, store.get('backSeamLength'));
let isect = utils.circlesIntersect(
points.bottomRight,
store.get("legSide"),
points.topLeft,
store.get("backSeamLength")
);
points.bottomLeft = isect[0];
// Store side seam length
store.set('sideSeamLength', points.topRight.dist(points.bottomRight));
store.set("sideSeamLength", points.topRight.dist(points.bottomRight));
// Handle back rise
points.topLeft = points.topLeft.shift(90, store.get('sideRise'));
points.topRight = points.topRight.shift(90, store.get('frontRise'));
points.topLeft = points.topLeft.shift(90, store.get("sideRise"));
points.topRight = points.topRight.shift(90, store.get("frontRise"));
// Path
paths.seam = new Path()
@ -36,8 +51,7 @@ export default function(part) {
.line(points.bottomLeft)
.line(points.topLeft)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
// Anchor point for sampling
points.anchor = points.topLeft;
@ -45,15 +59,15 @@ export default function(part) {
// Complete pattern?
if (complete) {
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5);
macro('title', {
macro("title", {
at: points.title.shift(90, 30),
nr: 3,
title: 'side'
title: "side"
});
if (sa) {
paths.sa = paths.seam.offset(sa * -1).attr('class', 'fabric sa');
paths.sa = paths.seam.offset(sa * -1).attr("class", "fabric sa");
}
macro('grainline', {
macro("grainline", {
from: new Point(points.bottomRight.x / 2, points.bottomRight.y),
to: new Point(points.bottomRight.x / 2, points.topRight.y)
});
@ -61,22 +75,22 @@ export default function(part) {
// Paperless?
if (paperless) {
macro('vd', {
macro("vd", {
from: points.bottomLeft,
to: points.topLeft,
x: points.topLeft.x - 15 - sa
});
macro('vd', {
macro("vd", {
from: points.bottomRight,
to: points.topRight,
x: points.topRight.x + 15 + sa
});
macro('hd', {
macro("hd", {
from: points.topLeft,
to: points.topRight,
y: points.topLeft.y - 15 - sa
});
macro('hd', {
macro("hd", {
from: points.bottomLeft,
to: points.bottomRight,
y: points.bottomLeft.y + 15 + sa
@ -84,4 +98,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -4,12 +4,9 @@ export default function(part) {
sa,
snippets,
Snippet,
utils,
store,
complete,
points,
measurements,
options,
macro,
Point,
paths,

View file

@ -1,23 +1,37 @@
export default function(part) {
let { units, paperless, sa, store, complete, points, options, macro, Point, paths, Path } = part.shorthand();
let {
units,
paperless,
sa,
store,
complete,
points,
macro,
Point,
paths,
Path
} = part.shorthand();
points.topLeft = new Point(0, 0);
points.bottomRight = new Point(
store.get("chestPocketHeight"),
store.get("chestPocketBagDepth") / 2
);
points.bottomLeft = new Point(
points.topLeft.x,
points.bottomRight.y
points.bottomLeft = new Point(points.topLeft.x, points.bottomRight.y);
points.topRight = new Point(points.bottomRight.x, points.topLeft.y);
points.startLeft = points.topLeft.shiftFractionTowards(
points.bottomLeft,
0.33
);
points.topRight = new Point(
points.bottomRight.x,
points.topLeft.y
);
points.startLeft = points.topLeft.shiftFractionTowards(points.bottomLeft, 0.33);
points.endLeft = points.topLeft.shiftFractionTowards(points.bottomLeft, 0.66);
points.startRight = points.topRight.shiftFractionTowards(points.bottomRight, 0.33);
points.endRight = points.topRight.shiftFractionTowards(points.bottomRight, 0.66);
points.startRight = points.topRight.shiftFractionTowards(
points.bottomRight,
0.33
);
points.endRight = points.topRight.shiftFractionTowards(
points.bottomRight,
0.66
);
paths.seam = new Path()
.move(points.startRight)
@ -57,7 +71,6 @@ export default function(part) {
from: points.bottomRight.shift(180, 15),
to: points.topRight.shift(180, 15),
text: units(store.get("chestPocketBagDepth") * 2)
});
if (paperless) {

View file

@ -1,28 +1,47 @@
export default function(part) {
// prettier-ignore
let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand();
let {
measurements,
options,
store,
points,
paths,
Point,
Path,
utils,
debug
} = part.shorthand();
// Where to divide our corset into panels
if (options.panels === 11) store.set('gaps', [0.15,0.275,0.4,0.6,0.75]);
else store.set('gaps', [0.2,0.35,0.5,0.65,0.8]);
if (options.panels === 11) store.set("gaps", [0.15, 0.275, 0.4, 0.6, 0.75]);
else store.set("gaps", [0.2, 0.35, 0.5, 0.65, 0.8]);
// Absolute values for some options
store.set('waistReduction', measurements.naturalWaist * options.waistReduction);
store.set(
"waistReduction",
measurements.naturalWaist * options.waistReduction
);
debug({
type: "info",
label: '✅ Waist reduction',
msg: utils.units(store.get('waistReduction'))
label: "✅ Waist reduction",
msg: utils.units(store.get("waistReduction"))
});
store.set('backOpening', measurements.underbust * options.backOpening);
store.set("backOpening", measurements.underbust * options.backOpening);
debug({
type: "info",
label: '✅ Back opening',
msg: utils.units(store.get('backOpening'))
label: "✅ Back opening",
msg: utils.units(store.get("backOpening"))
});
let len = measurements.naturalWaistToUnderbust + measurements.naturalWaistToHip;
for(let option of ['backRise', 'backDrop', 'frontRise', 'frontDrop', 'hipRise'])
let len =
measurements.naturalWaistToUnderbust + measurements.naturalWaistToHip;
for (let option of [
"backRise",
"backDrop",
"frontRise",
"frontDrop",
"hipRise"
])
store.set(option, len * options[option]);
store.set('length', len);
store.set("length", len);
/**
* How much should we take in the corset at waist and bust
@ -31,52 +50,60 @@ export default function(part) {
* Can I be sure? Maybe not, but a larger underbust than hip
* measurements seems very rare to say the least.
*/
store.set('width', 0.5 * (
measurements.hipsCircumference -
store.get('backOpening')
));
store.set('waistIntake', 0.5 * (
measurements.hipsCircumference -
store.set(
"width",
0.5 * (measurements.hipsCircumference - store.get("backOpening"))
);
store.set(
"waistIntake",
0.5 *
(measurements.hipsCircumference -
measurements.naturalWaist +
store.get('waistReduction')
));
store.set('bustIntake', 0.5 * (
measurements.hipsCircumference -
measurements.underbust
));
store.get("waistReduction"))
);
store.set(
"bustIntake",
0.5 * (measurements.hipsCircumference - measurements.underbust)
);
// Basic box (CB = Center back, CF = Center front)
let wid = store.get('width');
let wid = store.get("width");
points.underbustCF = new Point(0, 0);
points.hipsCF = new Point(0, len);
points.hipsCB = new Point(wid, len);
points.underbustCB = new Point(wid, 0);
points.topSide = points.underbustCF.shiftFractionTowards(points.underbustCB, 0.5);
points.topSide = points.underbustCF.shiftFractionTowards(
points.underbustCB,
0.5
);
points.bottomSide = points.hipsCF.shiftFractionTowards(points.hipsCB, 0.5);
points.waistCF = points.underbustCF.shift(-90, measurements.naturalWaistToUnderbust);
points.waistCF = points.underbustCF.shift(
-90,
measurements.naturalWaistToUnderbust
);
points.waistCB = new Point(points.hipsCB.x, points.waistCF.y);
// frontRise
points.topCF = points.underbustCF.shift(90, store.get('frontRise'));
points.topCF = points.underbustCF.shift(90, store.get("frontRise"));
points.frontRiseStart = points.underbustCF.shift(0, wid * 0.15);
points.frontRiseStartCp2 = points.underbustCF.shift(0, wid * 0.11);
points.topCFCp1 = points.topCF.shift(0, wid * 0.11);
// frontDrop
points.bottomCF = points.hipsCF.shift(-90, store.get('frontDrop'));
points.bottomCF = points.hipsCF.shift(-90, store.get("frontDrop"));
points.bottomCFCp2 = points.bottomCF.shift(0, wid * 0.11);
// hipRise
points.hipRise = points.bottomSide.shift(90, store.get('hipRise'));
points.hipRise = points.bottomSide.shift(90, store.get("hipRise"));
points.hipRiseCp1 = points.hipRise.shift(180, wid * 0.3);
points.hipRiseCp2 = points.hipRise.shift(0, wid * 0.2);
// backDrop
points.backDrop = points.hipsCB.shift(-90, store.get('backDrop'));
points.backDrop = points.hipsCB.shift(-90, store.get("backDrop"));
points.backDropCp1 = points.backDrop.shift(180, wid * 0.3);
// backRise
points.backRise = points.underbustCB.shift(90, store.get('backRise'));
points.backRise = points.underbustCB.shift(90, store.get("backRise"));
points.backRiseCp1 = points.backRise.shift(180, wid * 0.4);
points.topSideCp1 = points.topSide.shift(0, wid * 0.2);
@ -107,4 +134,4 @@ export default function(part) {
.close();
return part;
};
}

View file

@ -1,8 +1,15 @@
import draftPanel1ab from './panel1ab';
import draftPanel1ab from "./panel1ab";
export default function(part) {
// prettier-ignore
let {macro, sa, points, paths, Point, Path, options, complete, paperless } = part.shorthand();
let {
macro,
sa,
paths,
Path,
options,
complete,
paperless
} = part.shorthand();
delete paths.outline;
delete paths.panel2;
@ -15,57 +22,60 @@ export default function(part) {
// Complete pattern?
if (complete) {
macro('cutonfold', {
macro("cutonfold", {
to: points.bottomCF,
from: points.topCF,
grainline: true
});
points.title = points.waistCF.shiftFractionTowards(points.underbustGap1Left, 0.5);
macro('title', {
points.title = points.waistCF.shiftFractionTowards(
points.underbustGap1Left,
0.5
);
macro("title", {
nr: 1,
title: '',
title: "",
at: points.title
});
if(sa) paths.sa = paths.panel1.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.panel1.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro('vd', {
macro("vd", {
from: points.bottomCF,
to: points.waistCF,
x: points.topCF.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistCF,
to: points.topCF,
x: points.topCF.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap1,
to: points.waistGap1Left,
x: points.hipsGap1.x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistGap1Left,
to: points.underbustGap1Left,
x: points.hipsGap1.x + sa + 15
});
macro('hd', {
macro("hd", {
from: points.bottomCF,
to: points.hipsGap1,
y: points.bottomCF.y + sa + 15
});
macro('hd', {
macro("hd", {
from: points.topCF,
to: points.underbustGap1Left,
y: points.topCF.y - sa - 15
});
macro('ld', {
macro("ld", {
from: points.waistCF,
to: points.waistGap1Left
});
}
return part;
};
}

View file

@ -1,6 +1,15 @@
export default function(part) {
// prettier-ignore
let {macro, utils, sa, points, paths, Point, Path, options, complete, paperless } = part.shorthand();
let {
macro,
utils,
sa,
points,
paths,
Point,
Path,
complete,
paperless
} = part.shorthand();
let top = new Path()
.move(points.underbustGap1Left)
@ -8,22 +17,32 @@ export default function(part) {
points.topABsplit = top.shiftFractionAlong(0.3);
let bottom = new Path()
.move(points.bottomCF)
.curve(paths.panel1.ops[1].cp1, paths.panel1.ops[1].cp2, paths.panel1.ops[1].to);
.curve(
paths.panel1.ops[1].cp1,
paths.panel1.ops[1].cp2,
paths.panel1.ops[1].to
);
points.bottomABsplit = bottom.shiftFractionAlong(0.3);
paths.panel1a = bottom.split(points.bottomABsplit)[0]
paths.panel1a = bottom
.split(points.bottomABsplit)[0]
.line(points.topABsplit)
.join(top.split(points.topABsplit)[1])
.line(points.bottomCF)
.close()
.attr('class', 'fabric');
paths.panel1b = bottom.split(points.bottomABsplit)[1]
.attr("class", "fabric");
paths.panel1b = bottom
.split(points.bottomABsplit)[1]
.curve(points.hipsGap1Cp, points.waistGap1LeftCp1, points.waistGap1Left)
.curve(points.waistGap1LeftCp2, points.underbustGap1LeftCp, points.underbustGap1Left)
.curve(
points.waistGap1LeftCp2,
points.underbustGap1LeftCp,
points.underbustGap1Left
)
.join(top.split(points.topABsplit)[0])
.line(points.bottomABsplit)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
let translation = 5;
if (sa) translation = 2 * sa + 5;
paths.panel1b = paths.panel1b.translate(translation, 0);
@ -32,32 +51,40 @@ export default function(part) {
// Complete pattern?
if (complete) {
if (sa) {
paths.saA = paths.panel1a.offset(sa).attr('class', 'fabric sa');
paths.saB = paths.panel1b.offset(sa).attr('class', 'fabric sa');
paths.saA = paths.panel1a.offset(sa).attr("class", "fabric sa");
paths.saB = paths.panel1b.offset(sa).attr("class", "fabric sa");
}
macro('cutonfold', {
macro("cutonfold", {
to: points.bottomCF,
from: points.topCF,
grainline: true
});
macro('grainline', {
macro("grainline", {
to: points.topABsplit.translate(translation, 0),
from: new Point(
points.topABsplit.translate(translation, 0).x,
points.hipsGap1.translate(translation, 0).y
)
});
points.midwayAB = points.topABsplit.shiftFractionTowards(points.bottomABsplit, 0.5);
points.titleA = points.underbustCF.shiftFractionTowards(points.midwayAB, 0.5);
macro('title', {
nr: '1a',
prefix: 'panel1a',
points.midwayAB = points.topABsplit.shiftFractionTowards(
points.bottomABsplit,
0.5
);
points.titleA = points.underbustCF.shiftFractionTowards(
points.midwayAB,
0.5
);
macro("title", {
nr: "1a",
prefix: "panel1a",
at: points.titleA
});
points.titleB = points.hipsGap1.translate(translation, 0).shiftFractionTowards(points.midwayAB, 0.5);
macro('title', {
nr: '1b',
prefix: 'panel1b',
points.titleB = points.hipsGap1
.translate(translation, 0)
.shiftFractionTowards(points.midwayAB, 0.5);
macro("title", {
nr: "1b",
prefix: "panel1b",
at: points.titleB
});
}
@ -65,12 +92,12 @@ export default function(part) {
// Paperless?
if (paperless) {
// 1a
macro('vd', {
macro("vd", {
from: points.bottomCF,
to: points.waistCF,
x: points.topCF.x - sa - 30
});
macro('vd', {
macro("vd", {
from: points.waistCF,
to: points.topCF,
x: points.topCF.x - sa - 30
@ -81,61 +108,61 @@ export default function(part) {
points.waistCF,
points.waistGap1
);
macro('vd', {
macro("vd", {
from: points.bottomABsplit,
to: points.waistAB,
x: points.topCF.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistAB,
to: points.topABsplit,
x: points.topCF.x - sa - 15
});
macro('hd', {
macro("hd", {
from: points.bottomCF,
to: points.bottomABsplit,
y: points.bottomCF.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistCF,
to: points.waistAB,
to: points.waistAB
});
macro('hd', {
macro("hd", {
from: points.topCF,
to: points.topABsplit,
y: points.topCF.y - sa - 15
});
// 1b
macro('vd', {
macro("vd", {
from: points.hipsGap1.translate(translation, 0),
to: points.waistGap1Left.translate(translation, 0),
x: points.underbustGap1Left.translate(translation, 0).x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistGap1Left.translate(translation, 0),
to: points.underbustGap1Left.translate(translation, 0),
x: points.underbustGap1Left.translate(translation, 0).x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.bottomABsplit.translate(translation, 0),
to: points.waistAB.translate(translation, 0),
x: points.underbustGap1Left.translate(translation, 0).x + sa + 30
});
macro('vd', {
macro("vd", {
from: points.waistAB.translate(translation, 0),
to: points.topABsplit.translate(translation, 0),
x: points.underbustGap1Left.translate(translation, 0).x + sa + 30
});
macro('hd', {
macro("hd", {
from: points.bottomABsplit.translate(translation, 0),
to: points.hipsGap1.translate(translation, 0),
y: points.bottomABsplit.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistAB.translate(translation, 0),
to: points.waistGap1Left.translate(translation, 0)
});
macro('hd', {
macro("hd", {
from: points.topABsplit.translate(translation, 0),
to: points.underbustGap1Left.translate(translation, 0),
y: points.topABsplit.y - sa - 15
@ -143,4 +170,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,13 @@
export default function(part) {
// prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
let {
macro,
sa,
points,
paths,
Point,
complete,
paperless
} = part.shorthand();
delete paths.outline;
delete paths.panel1;
@ -19,51 +26,54 @@ export default function(part) {
points.grainlineTop.x,
points.hipsGap2.y
);
macro('grainline', {
macro("grainline", {
from: points.grainlineBottom,
to: points.grainlineTop
});
points.title = points.grainlineTop.shift(-90, points.grainlineTop.dy(points.waistGap2Left)/2);
macro('title', {
points.title = points.grainlineTop.shift(
-90,
points.grainlineTop.dy(points.waistGap2Left) / 2
);
macro("title", {
nr: 2,
title: '',
title: "",
at: points.title
});
if(sa) paths.sa = paths.panel2.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.panel2.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro('hd', {
macro("hd", {
from: points.hipsGap1,
to: points.hipsGap2,
y: points.hipsGap1.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistGap1Right,
to: points.waistGap2Left
});
macro('hd', {
macro("hd", {
from: points.underbustGap1Right,
to: points.underbustGap2Left,
y: points.underbustGap1Right.y - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap1,
to: points.waistGap1Right,
x: points.hipsGap1.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistGap1Right,
to: points.underbustGap1Right,
x: points.hipsGap1.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap2,
to: points.waistGap1Right,
x: points.hipsGap2.x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistGap1Right,
to: points.underbustGap2Left,
x: points.hipsGap2.x + sa + 15
@ -71,4 +81,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,13 @@
export default function(part) {
// prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
let {
macro,
sa,
points,
paths,
Point,
complete,
paperless
} = part.shorthand();
delete paths.outline;
delete paths.panel1;
@ -19,51 +26,54 @@ export default function(part) {
points.grainlineTop.x,
points.hipsGap3.y
);
macro('grainline', {
macro("grainline", {
from: points.grainlineBottom,
to: points.grainlineTop
});
points.title = points.grainlineTop.shift(-90, points.grainlineTop.dy(points.waistGap3Left)/2);
macro('title', {
points.title = points.grainlineTop.shift(
-90,
points.grainlineTop.dy(points.waistGap3Left) / 2
);
macro("title", {
nr: 3,
title: '',
title: "",
at: points.title
});
if(sa) paths.sa = paths.panel3.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.panel3.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro('hd', {
macro("hd", {
from: points.hipsGap2,
to: points.hipsGap3,
y: points.hipsGap2.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistGap2Right,
to: points.waistGap3Left
});
macro('hd', {
macro("hd", {
from: points.underbustGap2Right,
to: points.underbustGap3Left,
y: points.underbustGap2Right.y - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap2,
to: points.waistGap2Right,
x: points.hipsGap2.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistGap2Right,
to: points.underbustGap2Right,
x: points.hipsGap2.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap3,
to: points.waistGap2Right,
x: points.hipsGap3.x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistGap2Right,
to: points.underbustGap3Left,
x: points.hipsGap3.x + sa + 15
@ -71,4 +81,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,15 @@
export default function(part) {
// prettier-ignore
let {macro, sa, snippets, Snippet, points, paths, Point, complete, paperless } = part.shorthand();
let {
macro,
sa,
snippets,
Snippet,
points,
paths,
Point,
complete,
paperless
} = part.shorthand();
delete paths.outline;
delete paths.panel1;
@ -19,54 +28,60 @@ export default function(part) {
points.grainlineTop.x,
points.hipsGap4.y
);
macro('grainline', {
macro("grainline", {
from: points.grainlineBottom,
to: points.grainlineTop
});
points.title = points.grainlineTop.shift(-90, points.grainlineTop.dy(points.waistGap4Left)/2);
macro('title', {
points.title = points.grainlineTop.shift(
-90,
points.grainlineTop.dy(points.waistGap4Left) / 2
);
macro("title", {
nr: 4,
title: '',
title: "",
at: points.title
});
points.logo = points.grainlineTop.shiftFractionTowards(points.grainlineBottom, 0.8);
snippets.logo = new Snippet('logo', points.logo).attr('data-scale', 0.8);
points.logo = points.grainlineTop.shiftFractionTowards(
points.grainlineBottom,
0.8
);
snippets.logo = new Snippet("logo", points.logo).attr("data-scale", 0.8);
if(sa) paths.sa = paths.panel4.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.panel4.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro('hd', {
macro("hd", {
from: points.hipsGap3,
to: points.hipsGap4,
y: points.hipsGap3.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistGap3Right,
to: points.waistGap4Left
});
macro('hd', {
macro("hd", {
from: points.underbustGap3Right,
to: points.underbustGap4Left,
y: points.underbustGap4Left.y - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap3,
to: points.waistGap3Right,
x: points.hipsGap3.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistGap3Right,
to: points.underbustGap3Right,
x: points.hipsGap3.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap4,
to: points.waistGap3Right,
x: points.hipsGap4.x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistGap3Right,
to: points.underbustGap4Left,
x: points.hipsGap4.x + sa + 15
@ -74,4 +89,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,13 @@
export default function(part) {
// prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
let {
macro,
sa,
points,
paths,
Point,
complete,
paperless
} = part.shorthand();
delete paths.outline;
delete paths.panel1;
@ -19,51 +26,54 @@ export default function(part) {
points.grainlineTop.x,
points.hipsGap5.y
);
macro('grainline', {
macro("grainline", {
from: points.grainlineBottom,
to: points.grainlineTop
});
points.title = points.grainlineTop.shift(-90, points.grainlineTop.dy(points.waistGap5Left)/2);
macro('title', {
points.title = points.grainlineTop.shift(
-90,
points.grainlineTop.dy(points.waistGap5Left) / 2
);
macro("title", {
nr: 5,
title: '',
title: "",
at: points.title
});
if(sa) paths.sa = paths.panel5.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.panel5.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro('hd', {
macro("hd", {
from: points.hipsGap4,
to: points.hipsGap5,
y: points.hipsGap4.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistGap4Right,
to: points.waistGap5Left
});
macro('hd', {
macro("hd", {
from: points.underbustGap4Right,
to: points.underbustGap5Left,
y: points.underbustGap5Left.y - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap4,
to: points.waistGap4Right,
x: points.hipsGap4.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistGap4Right,
to: points.underbustGap4Right,
x: points.hipsGap4.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap5,
to: points.waistGap4Right,
x: points.hipsGap5.x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistGap4Right,
to: points.underbustGap5Left,
x: points.hipsGap5.x + sa + 15
@ -71,4 +81,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,13 @@
export default function(part) {
// prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
let {
macro,
sa,
points,
paths,
Point,
complete,
paperless
} = part.shorthand();
delete paths.outline;
delete paths.panel1;
@ -19,59 +26,59 @@ export default function(part) {
points.grainlineTop.x,
points.hipsGap5.y
);
macro('grainline', {
macro("grainline", {
from: points.grainlineBottom,
to: points.grainlineTop
});
points.title = points.grainlineTop.shift(-90, points.grainlineTop.dy(points.waistGap5Right)/2);
macro('title', {
points.title = points.grainlineTop.shift(
-90,
points.grainlineTop.dy(points.waistGap5Right) / 2
);
macro("title", {
nr: 6,
title: '',
title: "",
at: points.title
});
points.scalebox = new Point(
points.grainlineTop.x,
points.hipsGap5.y - 55
);
macro('scalebox', {
points.scalebox = new Point(points.grainlineTop.x, points.hipsGap5.y - 55);
macro("scalebox", {
at: points.scalebox,
rotate: 90
});
if(sa) paths.sa = paths.panel6.offset(sa).attr('class', 'fabric sa');
if (sa) paths.sa = paths.panel6.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro('hd', {
macro("hd", {
from: points.hipsGap5,
to: points.backDrop,
y: points.backDrop.y + sa + 15
});
macro('ld', {
macro("ld", {
from: points.waistGap5Right,
to: points.waistCB
});
macro('hd', {
macro("hd", {
from: points.underbustGap5Right,
to: points.backRise,
y: points.backRise.y - sa - 15
});
macro('vd', {
macro("vd", {
from: points.hipsGap5,
to: points.waistGap5Right,
x: points.hipsGap5.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.waistGap5Right,
to: points.underbustGap5Right,
x: points.hipsGap5.x - sa - 15
});
macro('vd', {
macro("vd", {
from: points.backDrop,
to: points.waistCB,
x: points.backDrop.x + sa + 15
});
macro('vd', {
macro("vd", {
from: points.waistCB,
to: points.backRise,
x: points.backDrop.x + sa + 15
@ -79,4 +86,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,33 +1,79 @@
export default function(part) {
// prettier-ignore
let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand();
let {
measurements,
options,
store,
points,
paths,
Point,
Path,
debug
} = part.shorthand();
let count = 1;
let bottom = new Path()
.move(points.bottomCF)
.curve(points.bottomCFCp2, points.hipRiseCp1, points.hipRise)
.curve(points.hipRiseCp2, points.backDropCp1, points.backDrop)
.attr('class', 'lashed various stroke-xl');
for (let gap of store.get('gaps')) {
.attr("class", "lashed various stroke-xl");
for (let gap of store.get("gaps")) {
// Underbust
points[`underbustGap${count}`] = new Point(store.get('width') * gap, 0);
points[`underbustGap${count}Right`] = points[`underbustGap${count}`].shift(0, store.get('bustIntake') * 0.1);
points[`underbustGap${count}Left`] = points[`underbustGap${count}`].shift(180, store.get('bustIntake') * 0.1);
points[`underbustGap${count}RightCp`] = points[`underbustGap${count}Right`].shift(-90, measurements.naturalWaistToUnderbust * 0.15);
points[`underbustGap${count}LeftCp`] = points[`underbustGap${count}Left`].shift(-90, measurements.naturalWaistToUnderbust * 0.15);
points[`underbustGap${count}`] = new Point(store.get("width") * gap, 0);
points[`underbustGap${count}Right`] = points[`underbustGap${count}`].shift(
0,
store.get("bustIntake") * 0.1
);
points[`underbustGap${count}Left`] = points[`underbustGap${count}`].shift(
180,
store.get("bustIntake") * 0.1
);
points[`underbustGap${count}RightCp`] = points[
`underbustGap${count}Right`
].shift(-90, measurements.naturalWaistToUnderbust * 0.15);
points[`underbustGap${count}LeftCp`] = points[
`underbustGap${count}Left`
].shift(-90, measurements.naturalWaistToUnderbust * 0.15);
// Waist
points[`waistGap${count}`] = new Point(store.get('width') * gap, points.waistCF.y);
points[`waistGap${count}Right`] = points[`waistGap${count}`].shift(0, store.get('waistIntake') * 0.1);
points[`waistGap${count}Left`] = points[`waistGap${count}`].shift(180, store.get('waistIntake') * 0.1);
points[`waistGap${count}RightCp1`] = points[`waistGap${count}Right`].shift(90, measurements.naturalWaistToUnderbust * 0.2);
points[`waistGap${count}LeftCp2`] = points[`waistGap${count}Left`].shift(90, measurements.naturalWaistToUnderbust * 0.2);
points[`waistGap${count}RightCp2`] = points[`waistGap${count}Right`].shift(-90, measurements.naturalWaistToHip * 0.2);
points[`waistGap${count}LeftCp1`] = points[`waistGap${count}Left`].shift(-90, measurements.naturalWaistToHip * 0.2);
points[`waistGap${count}`] = new Point(
store.get("width") * gap,
points.waistCF.y
);
points[`waistGap${count}Right`] = points[`waistGap${count}`].shift(
0,
store.get("waistIntake") * 0.1
);
points[`waistGap${count}Left`] = points[`waistGap${count}`].shift(
180,
store.get("waistIntake") * 0.1
);
points[`waistGap${count}RightCp1`] = points[`waistGap${count}Right`].shift(
90,
measurements.naturalWaistToUnderbust * 0.2
);
points[`waistGap${count}LeftCp2`] = points[`waistGap${count}Left`].shift(
90,
measurements.naturalWaistToUnderbust * 0.2
);
points[`waistGap${count}RightCp2`] = points[`waistGap${count}Right`].shift(
-90,
measurements.naturalWaistToHip * 0.2
);
points[`waistGap${count}LeftCp1`] = points[`waistGap${count}Left`].shift(
-90,
measurements.naturalWaistToHip * 0.2
);
// Hips
points[`hipsGap${count}`] = new Point(store.get('width') * gap, points.hipsCF.y);
points[`hipsGap${count}`] = bottom.intersectsX(points[`waistGap${count}`].x).pop();
points[`hipsGap${count}Cp`] = points[`hipsGap${count}`].shiftFractionTowards(points[`waistGap${count}`], 0.2);
points[`hipsGap${count}`] = new Point(
store.get("width") * gap,
points.hipsCF.y
);
points[`hipsGap${count}`] = bottom
.intersectsX(points[`waistGap${count}`].x)
.pop();
points[`hipsGap${count}Cp`] = points[
`hipsGap${count}`
].shiftFractionTowards(points[`waistGap${count}`], 0.2);
count++;
}
@ -35,21 +81,33 @@ export default function(part) {
paths.panel1 = bottom
.split(points.hipsGap1)[0]
.curve(points.hipsGap1Cp, points.waistGap1LeftCp1, points.waistGap1Left)
.curve(points.waistGap1LeftCp2, points.underbustGap1LeftCp, points.underbustGap1Left)
.curve(
points.waistGap1LeftCp2,
points.underbustGap1LeftCp,
points.underbustGap1Left
)
.curve(points.frontRiseStartCp2, points.topCFCp1, points.topCF)
.line(points.bottomCF)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
paths.panel2 = bottom
.split(points.hipsGap2)[0]
.split(points.hipsGap1)[1]
.curve(points.hipsGap2Cp, points.waistGap2LeftCp1, points.waistGap2Left)
.curve(points.waistGap2LeftCp2, points.underbustGap2LeftCp, points.underbustGap2Left)
.curve(
points.waistGap2LeftCp2,
points.underbustGap2LeftCp,
points.underbustGap2Left
)
.line(points.underbustGap1Right)
.curve(points.underbustGap1RightCp, points.waistGap1RightCp1, points.waistGap1Right)
.curve(
points.underbustGap1RightCp,
points.waistGap1RightCp1,
points.waistGap1Right
)
.curve(points.waistGap1RightCp2, points.hipsGap1Cp, points.hipsGap1)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
let panel3 = new Path()
.move(points.bottomCF)
.curve(points.bottomCFCp2, points.hipRiseCp1, points.hipRise)
@ -57,31 +115,53 @@ export default function(part) {
if (options.panels === 11) panel3 = panel3.split(points.hipsGap3)[0];
paths.panel3 = panel3
.curve(points.hipsGap3Cp, points.waistGap3LeftCp1, points.waistGap3Left)
.curve(points.waistGap3LeftCp2, points.underbustGap3LeftCp, points.underbustGap3Left)
.curve(
points.waistGap3LeftCp2,
points.underbustGap3LeftCp,
points.underbustGap3Left
)
.line(points.underbustGap2Right)
.curve(points.underbustGap2RightCp, points.waistGap2RightCp1, points.waistGap2Right)
.curve(
points.underbustGap2RightCp,
points.waistGap2RightCp1,
points.waistGap2Right
)
.curve(points.waistGap2RightCp2, points.hipsGap2Cp, points.hipsGap2)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
let topBack = new Path()
.move(points.backRise)
.curve(points.backRiseCp1, points.topSideCp1, points.topSide);
points.underbustGap4Left = topBack.intersectsX(points.underbustGap4Left.x).pop();
points.underbustGap4Left = topBack
.intersectsX(points.underbustGap4Left.x)
.pop();
paths.panel4 = new Path()
.move(points.hipRise)
.curve(points.hipRiseCp2, points.backDropCp1, points.backDrop)
.split(points.hipsGap4)[0]
.curve(points.hipsGap4Cp, points.waistGap4LeftCp1, points.waistGap4Left)
.curve(points.waistGap4LeftCp2, points.underbustGap4LeftCp, points.underbustGap4Left)
.curve(
points.waistGap4LeftCp2,
points.underbustGap4LeftCp,
points.underbustGap4Left
)
.join(topBack.split(points.underbustGap4Left)[1]);
if (options.panels === 11) paths.panel4.line(points.underbustGap3Right);
paths.panel4
.curve(points.underbustGap3RightCp, points.waistGap3RightCp1, points.waistGap3Right)
.curve(
points.underbustGap3RightCp,
points.waistGap3RightCp1,
points.waistGap3Right
)
.curve(points.waistGap3RightCp2, points.hipsGap3Cp, points.hipsGap3)
.close()
.attr('class', 'fabric');
points.underbustGap4Right = topBack.intersectsX(points.underbustGap4Right.x).pop();
points.underbustGap5Left = topBack.intersectsX(points.underbustGap5Left.x).pop();
.attr("class", "fabric");
points.underbustGap4Right = topBack
.intersectsX(points.underbustGap4Right.x)
.pop();
points.underbustGap5Left = topBack
.intersectsX(points.underbustGap5Left.x)
.pop();
let top5 = topBack
.split(points.underbustGap5Left)[1]
.split(points.underbustGap4Right)[0];
@ -89,23 +169,37 @@ export default function(part) {
.split(points.hipsGap5)[0]
.split(points.hipsGap4)[1]
.curve(points.hipsGap5Cp, points.waistGap5LeftCp1, points.waistGap5Left)
.curve(points.waistGap5LeftCp2, points.underbustGap5LeftCp, points.underbustGap5Left)
.curve(
points.waistGap5LeftCp2,
points.underbustGap5LeftCp,
points.underbustGap5Left
)
.curve(top5.ops[1].cp1, top5.ops[1].cp2, top5.ops[1].to)
.curve(points.underbustGap4RightCp, points.waistGap4RightCp1, points.waistGap4Right)
.curve(
points.underbustGap4RightCp,
points.waistGap4RightCp1,
points.waistGap4Right
)
.curve(points.waistGap4RightCp2, points.hipsGap4Cp, points.hipsGap4)
.close()
.attr('class', 'fabric');
points.underbustGap5Right = topBack.intersectsX(points.underbustGap5Right.x).pop();
.attr("class", "fabric");
points.underbustGap5Right = topBack
.intersectsX(points.underbustGap5Right.x)
.pop();
paths.panel6 = bottom
.split(points.hipsGap5)[1]
.line(points.backRise)
.join(topBack.split(points.underbustGap5Right)[0])
.curve(points.underbustGap5RightCp, points.waistGap5RightCp1, points.waistGap5Right)
.curve(
points.underbustGap5RightCp,
points.waistGap5RightCp1,
points.waistGap5Right
)
.curve(points.waistGap5RightCp2, points.hipsGap5Cp, points.hipsGap5)
.close()
.attr('class', 'fabric');
.attr("class", "fabric");
paths.outline.render = false;
return part;
};
}

View file

@ -16,13 +16,9 @@ const FormFieldChecks = props => {
props.updateValue(props.name, parts);
};
// Force state update when rerendering due to props change
// if (props.value !== value) setValue(props.value);
return (
<FormGroup>
{Object.keys(props.checks).map(i => {
let check = props.checks[i];
return (
<FormControlLabel
control={

View file

@ -1,10 +1,9 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import TextField from "@material-ui/core/TextField";
import IconButton from "@material-ui/core/IconButton";
import InvalidIcon from "@material-ui/icons/Warning";
import InputAdornment from "@material-ui/core/InputAdornment";
import { withStyles } from "@material-ui/core/styles";
import { measurementAsMm, formatMm } from "@freesewing/utils";
import { injectIntl } from "react-intl";
@ -16,10 +15,6 @@ const FormFieldMeasurement = props => {
);
};
const distance = {
asMm: () => false
};
return (
<TextField
id={props.name}

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
const Circle = props => (

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import Path from "../Path";
import Point from "../Point";
@ -73,11 +73,6 @@ const Part = props => {
let focus = [];
if (props.design) {
let designProps = {
...props,
key: "dp-" + props.name,
className: "design point"
};
if (props.focus && typeof props.focus[props.name] !== "undefined") {
for (let i in props.focus[props.name].points)
focus.push(focusPoint(props.focus[props.name].points[i], i));

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import TextOnPath from "../TextOnPath";
import DesignPath from "../DesignPath";

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import DesignPoint from "../DesignPoint";
import Text from "../Text";

View file

@ -1,7 +1,5 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import Text from "../Text";
import Circle from "../Circle";
const Snippet = props => {
const snippetProps = {

View file

@ -1,9 +0,0 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
const Style = props => <style>{props.css}</style>;
Style.propTypes = { css: PropTypes.string };
Style.defaultProps = { css: "" };
export default Style;

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
const Svg = props => {

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import { strings } from "@freesewing/i18n";

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import { strings } from "@freesewing/i18n";

View file

@ -1,11 +1,10 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import Svg from "./Svg";
import Defs from "./Defs";
import Part from "./Part";
const Draft = props => {
return (
const Draft = props => (
<Svg
embed={props.settings.embed}
width={props.width}
@ -36,7 +35,6 @@ const Draft = props => {
</g>
</Svg>
);
};
Draft.propTypes = {
parts: PropTypes.object.isRequired,

View file

@ -1,7 +1,7 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
import FormFieldSlider from "../../.form/FormFieldSlider";
import { formatMm, roundMm, defaultSa, sliderStep } from "@freesewing/utils";
import { formatMm, roundMm, sliderStep } from "@freesewing/utils";
import OptionPreamble from "../OptionPreamble";
const DraftSettingMargin = props => {

View file

@ -1,8 +1,6 @@
import React, { useState } from "react";
import FormFieldChecks from "../../.form/FormFieldChecks";
import FormFieldList from "../../.form/FormFieldList";
import FormFieldSlider from "../../.form/FormFieldSlider";
import { formatMm, roundMm, defaultSa, sliderStep } from "@freesewing/utils";
import OptionPreamble from "../OptionPreamble";
const DraftSettingOnly = props => {

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import Pct from "../PatternOptionPercentage";
import Deg from "../PatternOptionDegree";
@ -59,10 +59,10 @@ const OptionGroup = props => {
return (
<React.Fragment>
{props.options.map(name => {
let key = name;
//let key = name;
let output = [];
if (typeof name === "object") {
key = Object.keys(name).pop();
//key = Object.keys(name).pop();
// Subgroup
for (let subGroup of Object.keys(name)) {
output.push(

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import IconButton from "@material-ui/core/IconButton";
import DownIcon from "@material-ui/icons/KeyboardArrowDown";

View file

@ -19,19 +19,6 @@ const PatternOptionList = props => {
const toggleExpanded = () => setExpanded(!expanded);
const styles = {
container: {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
left: {
flexGrow: 1,
margin: "0 0.5rem"
},
right: { margin: "0 0.5rem" }
};
// Add translations
let stringKey = `options.${props.pattern}.${props.name}.options.`;
let list = {};

View file

@ -36,19 +36,6 @@ const PatternOptionMillimeter = props => {
const toggleExpanded = () => setExpanded(!expanded);
const styles = {
container: {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
left: {
flexGrow: 1,
margin: "0 0.5rem"
},
right: { margin: "0 0.5rem" }
};
let option = (
<FormFieldSlider
name={props.name}

View file

@ -1,11 +1,6 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
import Pct from "../PatternOptionPercentage";
import Deg from "../PatternOptionDegree";
import Mm from "../PatternOptionMillimeter";
import Bool from "../PatternOptionBool";
import OptionGroup from "../OptionGroup";
import { optionType } from "@freesewing/utils";
import { FormattedMessage } from "react-intl";
import DownIcon from "@material-ui/icons/KeyboardArrowDown";

View file

@ -1,11 +1,5 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
import Pct from "./PatternOptionPercentage";
import Deg from "./PatternOptionDegree";
import Mm from "./PatternOptionMillimeter";
import Bool from "./PatternOptionBool";
import OptionGroup from "./OptionGroup";
import { optionType } from "@freesewing/utils";
import { FormattedMessage } from "react-intl";
import PatternOptions from "./PatternOptions";
import DraftSettings from "./DraftSettings";
@ -13,14 +7,6 @@ import DraftSettings from "./DraftSettings";
const DraftConfigurator = props => {
const [expanded, setExpanded] = useState([]);
const toggleGroup = group => {
let shown = expanded.slice(0);
let index = shown.indexOf(group);
if (index === -1) shown.push(group);
else shown.splice(index, 1);
setExpanded(shown);
};
console.log("dc props", props);
return (
<ul className="nav l1">
<li>

View file

@ -1,8 +1,6 @@
import React from "react";
import PropTypes from "prop-types";
import Logo from "../Logo";
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
import Button from "@material-ui/core/Button";
import IconButton from "@material-ui/core/IconButton";
import Icon from "../Icon";

View file

@ -3,14 +3,7 @@ import { storiesOf } from "@storybook/react";
import Navbar from ".";
import LanguageIcon from "@material-ui/icons/Translate";
import DarkModeIcon from "@material-ui/icons/Brightness3";
import Avatar from "@material-ui/core/Avatar";
const props = {
raiseEvent: (type, data) =>
console.log(`Action of type ${type} triggered, data passed is`, data),
updateValue: (type, data) =>
console.log(`Update ${type} with new value`, data)
};
const navs = {
left: [
{

View file

@ -1,6 +1,5 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import { optionType } from "@freesewing/utils";
import { FormattedMessage } from "react-intl";
import { injectIntl } from "react-intl";
@ -8,10 +7,8 @@ const OptionGroup = props => {
return (
<React.Fragment>
{props.options.map(name => {
let key = name;
let output = [];
if (typeof name === "object") {
key = Object.keys(name).pop();
// Subgroup
for (let subGroup of Object.keys(name)) {
output.push(

View file

@ -1,9 +1,7 @@
import React, { useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import OptionGroup from "../OptionGroup";
import { optionType } from "@freesewing/utils";
import { FormattedMessage } from "react-intl";
import DownIcon from "@material-ui/icons/KeyboardArrowDown";
const PatternOptions = props => {
const renderGroup = group => {

View file

@ -7,14 +7,6 @@ import models from "@freesewing/models";
const SampleConfigurator = props => {
const [expanded, setExpanded] = useState([]);
const toggleGroup = group => {
let shown = expanded.slice(0);
let index = shown.indexOf(group);
if (index === -1) shown.push(group);
else shown.splice(index, 1);
setExpanded(shown);
};
const sampleOption = option => {
props.updateGist(
{

View file

@ -1,6 +1,4 @@
import React from "react";
import PropTypes from "prop-types";
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
const Design = props => {
// Methods

View file

@ -1,10 +1,8 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
import { defaultGist } from "@freesewing/utils";
import Draft from "../../Draft";
import Design from "../Design";
import DraftConfigurator from "../../DraftConfigurator";
import { strings } from "@freesewing/i18n";
import { FormattedMessage } from "react-intl";
import Prism from "prismjs";

View file

@ -1,6 +1,5 @@
import React, { useState, useEffect } from "react";
import React from "react";
import PropTypes from "prop-types";
import { storage } from "@freesewing/utils";
import Button from "@material-ui/core/Button";
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
import FormFieldMeasurement from "../../.form/FormFieldMeasurement";

View file

@ -1,10 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import { defaultGist } from "@freesewing/utils";
import Draft from "../../Draft";
import SampleConfigurator from "../../SampleConfigurator";
import svgattrPlugin from "@freesewing/plugin-svgattr";
import { strings } from "@freesewing/i18n";
import { FormattedMessage } from "react-intl";
const SamplePattern = props => {

View file

@ -1,10 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import Logo from "../../Logo";
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
import { FormattedMessage } from "react-intl";
import Button from "@material-ui/core/Button";
import IconButton from "@material-ui/core/IconButton";
import Icon from "../../Icon";
const Welcome = props => {
const styles = {

View file

@ -1,14 +1,10 @@
import React, { useState, useEffect } from "react";
import PropTypes from "prop-types";
import withGist from "../withGist";
import { FormattedMessage, IntlProvider } from "react-intl";
import Button from "@material-ui/core/Button";
import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles";
import { strings } from "@freesewing/i18n";
import Navbar from "../Navbar";
import { defaultGist, storage } from "@freesewing/utils";
import { dark, light } from "@freesewing/mui-theme";
import Logo from "../Logo";
import withLanguage from "../withLanguage";
import LanguageIcon from "@material-ui/icons/Translate";
import DarkModeIcon from "@material-ui/icons/Brightness3";
@ -74,11 +70,6 @@ const Workbench = props => {
return false;
};
const showLanguageChooser = () => saveDisplay("language");
const updatePattern = p => {
setPattern(p);
store.set("pattern", p);
};
const toggleDarkMode = () => {
if (theme === "light") setTheme("dark");
else setTheme("light");

View file

@ -54,7 +54,7 @@ const withGist = (WrappedComponent, settings = { gist: {}, store: false }) => {
if (l3) gist[l1][l2][l3] = value;
else if (l2) gist[l1][l2] = value;
else if (l1) gist[l1] = value;
else gist[l1] = value;
this.setState({ gist });
if (settings.store) storage.set(this.state.gist.name || "gist", gist);
}

View file

@ -6,7 +6,6 @@ import es from "react-intl/locale-data/es";
import fr from "react-intl/locale-data/fr";
import nl from "react-intl/locale-data/nl";
import { strings } from "@freesewing/i18n";
import { storage } from "@freesewing/utils";
const withLanguage = (WrappedComponent, lang = "en", store = false) => {
return class extends React.Component {

View file

@ -666,7 +666,7 @@ Path.prototype.split = function(point) {
let divided = this.divide();
let firstHalf = false;
let secondHalf = false;
for (let pi in divided) {
for (let pi = 0; pi < divided.length; pi++) {
let path = divided[pi];
if (path.ops[1].type === "line") {
if (pointOnLine(path.ops[0].to, path.ops[1].to, point)) {
@ -725,7 +725,7 @@ Path.prototype.split = function(point) {
/** Removes self-intersections (overlap) from the path */
Path.prototype.trim = function() {
let chunks = this.divide();
for (let i in chunks) {
for (let i = 0; i < chunks.length; i++) {
let firstCandidate = parseInt(i) + 2;
let lastCandidate = parseInt(chunks.length) - 1;
for (let j = firstCandidate; j < lastCandidate; j++) {

View file

@ -1,7 +1,5 @@
"use strict";
const path = require("path");
const fs = require("fs");
const inquirer = require("inquirer");
const validateNpmName = require("validate-npm-package-name");
const languages = require("@freesewing/i18n").languages;

View file

@ -37,6 +37,11 @@ export default {
}),
resolve({ browser: true }),
json(),
commonjs()
commonjs(),
minify({
comments: false,
sourceMap: true,
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
})
]
};

View file

@ -1,7 +1,6 @@
import freesewing from "@freesewing/core";
import plugins from "@freesewing/plugin-bundle";
import config from "../config/";
import { version } from "../package.json";
// Path API
import draftPath_ops from "./path_ops";
import draftPath_attr from "./path_attr";
@ -103,7 +102,6 @@ let methods = {
draftPlugin_logo,
draftPlugin_scalebox,
draftPlugin_title,
draftPoint_attr,
draftPoint_angle,
draftPoint_attr,
draftPoint_clone,

View file

@ -1,6 +1,5 @@
export default part => {
// prettier-ignore
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand();
points.A = new Point(45, 60);
points.B = new Point(10, 30);

View file

@ -1,6 +1,5 @@
export default part => {
// prettier-ignore
let { Point, points, Path, paths } = part.shorthand()
let { Point, points, Path, paths } = part.shorthand();
points.A = new Point(45, 60);
points.B = new Point(10, 30);

View file

@ -1,6 +1,13 @@
export default part => {
// prettier-ignore
let { Point, points, Path, paths, Snippet, snippets, utils } = part.shorthand()
let {
Point,
points,
Path,
paths,
Snippet,
snippets,
utils
} = part.shorthand();
points.from1 = new Point(10, 10);
points.to1 = new Point(90, 60);

View file

@ -1,13 +1,5 @@
export default part => {
let {
Point,
points,
Path,
paths,
utils,
snippets,
Snippet
} = part.shorthand();
let { Point, points, Path, paths, utils } = part.shorthand();
points.from = new Point(40, 10);
points.to = new Point(40, 80);

View file

@ -2,15 +2,11 @@ export default function(part) {
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,
measurements
Path
} = part.shorthand();
paths.hint = paths.seam.clone().attr("class", "dashed stroke-sm");

View file

@ -2,15 +2,11 @@ export default function(part) {
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,
measurements
Path
} = part.shorthand();
paths.hint = new Path()

View file

@ -2,15 +2,11 @@ export default function(part) {
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,
measurements,
snippets,
Snippet
} = part.shorthand();

View file

@ -1,29 +1,20 @@
export default function(part) {
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,
measurements,
snippets,
Snippet
} = part.shorthand();
const fitCap = (part, scale) => {
let {
paperless,
sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,

View file

@ -4,14 +4,11 @@ export default function(part) {
let {
store,
macro,
Point,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa,
options,
measurements

View file

@ -4,15 +4,12 @@ export default function(part) {
let {
utils,
store,
macro,
Point,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa,
options,
measurements

View file

@ -1,8 +1,6 @@
export default function(part) {
let {
store,
macro,
Point,
Path,
points,
paths,
@ -11,8 +9,7 @@ export default function(part) {
snippets,
Snippet,
sa,
options,
measurements
options
} = part.shorthand();
if (!options.pocket) return part;

View file

@ -1,16 +1,5 @@
export const sharedDimensions = function(part, s) {
let {
macro,
Point,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa
} = part.shorthand();
let { macro, Point, points, sa } = part.shorthand();
if (s === "front") {
points.cHem = points.cfHem;

View file

@ -6,8 +6,6 @@ export default function(part) {
paths,
store,
options,
measurements,
utils,
complete,
sa,
paperless,

View file

@ -4,8 +4,20 @@ export default function(part) {
part.paths = {};
part.paths.seam = seam;
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, debug} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro,
debug
} = part.shorthand();
// Hem is more descripting than hips in this case
//points.cbHem = points.cbHips;
@ -50,10 +62,7 @@ export default function(part) {
});
points.title = new Point(points.armhole.x / 2, points.armhole.y);
macro("title", { at: points.title, nr: 2, title: "back" });
store.set(
"notchBack",
points.raglanTipBack.dist(points.armholeHollow) / 2
);
store.set("notchBack", points.raglanTipBack.dist(points.armholeHollow) / 2);
points.sleeveNotch = points.raglanTipBack.shiftTowards(
points.armholeHollow,
store.get("notchBack")
@ -109,4 +118,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,16 @@
export default function(part) {
// prettier-ignore
let {measurements, options, sa, Point, points, Path, paths, complete, paperless, macro, units} = part.shorthand();
let {
measurements,
options,
sa,
Point,
points,
Path,
paths,
complete,
paperless,
macro
} = part.shorthand();
let width =
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) *

View file

@ -4,8 +4,23 @@ export default function(part) {
part.paths = {};
part.paths.seam = seam;
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, debug} = part.shorthand();
let {
utils,
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro,
debug
} = part.shorthand();
// Absolute values for percentages
store.set(

View file

@ -1,6 +1,16 @@
export default function(part) {
// prettier-ignore
let {store, sa, Point, points, Path, paths, complete, paperless, macro, units} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
complete,
paperless,
macro,
units
} = part.shorthand();
let width = store.get("hoodCenterWidth");
points.topLeft = new Point(0, 0);
@ -34,10 +44,7 @@ export default function(part) {
if (sa) {
paths.sa = paths.seam.offset(sa);
}
points.title = points.bottomLeft.shiftFractionTowards(
points.topRight,
0.5
);
points.title = points.bottomLeft.shiftFractionTowards(points.topRight, 0.5);
macro("title", { at: points.title, nr: 7, title: "hoodCenter" });
macro("grainline", {
from: points.topLeft.shift(-90, width / 2),
@ -61,4 +68,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,19 @@
export default function(part) {
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, debug} = part.shorthand();
let {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
measurements,
complete,
paperless,
macro,
debug
} = part.shorthand();
let neckOpening =
store.get("neckOpeningLenFront") + store.get("neckOpeningLenBack");
@ -145,4 +158,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -4,8 +4,18 @@ export default function(part) {
part.paths = {};
part.snippets = {};
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, debug} = part.shorthand();
let {
utils,
store,
sa,
points,
Path,
paths,
complete,
paperless,
macro,
debug
} = part.shorthand();
paths.seam = pocket
.line(points.cfRibbing)
@ -38,10 +48,7 @@ export default function(part) {
from: points.cfRibbing.shift(0, 15),
to: points.pocketCf.shift(0, 15)
});
points.title = points.cfRibbing.shiftFractionTowards(
points.pocketTop,
0.5
);
points.title = points.cfRibbing.shiftFractionTowards(points.pocketTop, 0.5);
macro("title", { at: points.title, nr: 4, title: "pocket" });
if (sa) {
paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
@ -73,4 +80,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -3,8 +3,16 @@ export default function(part) {
let facing = part.paths.facing;
part.paths = {};
// prettier-ignore
let {sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, utils, store} = part.shorthand();
let {
sa,
points,
Path,
paths,
complete,
paperless,
macro,
store
} = part.shorthand();
paths.seam = facing
.line(points.pocketTop)
@ -44,4 +52,4 @@ export default function(part) {
}
return part;
};
}

View file

@ -1,6 +1,21 @@
export default function(part) {
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, complete, paperless, macro, debug} = part.shorthand();
let {
utils,
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro,
debug
} = part.shorthand();
// Top of raglan sleeve
points.raglanTop = new Point(

View file

@ -1,6 +1,17 @@
export default function(part) {
// prettier-ignore
let {measurements, options, sa, Point, points, Path, paths, complete, paperless, macro, units} = part.shorthand();
let {
measurements,
options,
sa,
Point,
points,
Path,
paths,
complete,
paperless,
macro,
units
} = part.shorthand();
let width =
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) *

View file

@ -42,7 +42,6 @@ for (let pattern of Object.keys(patterns)) {
if (typeof value === "object") options[pattern][option] = value;
else {
if (typeof value === "undefined") {
let inherit = shared[pattern].dflt;
if (typeof patterns[shared[pattern].dflt][option] === "object")
options[pattern][option] = patterns[shared[pattern].dflt][option];
else if (

View file

@ -42,7 +42,6 @@ for (let pattern of Object.keys(patterns)) {
if (typeof value === "object") options[pattern][option] = value;
else {
if (typeof value === "undefined") {
let inherit = shared[pattern].dflt;
if (typeof patterns[shared[pattern].dflt][option] === "object")
options[pattern][option] = patterns[shared[pattern].dflt][option];
else if (

View file

@ -42,7 +42,6 @@ for (let pattern of Object.keys(patterns)) {
if (typeof value === "object") options[pattern][option] = value;
else {
if (typeof value === "undefined") {
let inherit = shared[pattern].dflt;
if (typeof patterns[shared[pattern].dflt][option] === "object")
options[pattern][option] = patterns[shared[pattern].dflt][option];
else if (

View file

@ -42,7 +42,6 @@ for (let pattern of Object.keys(patterns)) {
if (typeof value === "object") options[pattern][option] = value;
else {
if (typeof value === "undefined") {
let inherit = shared[pattern].dflt;
if (typeof patterns[shared[pattern].dflt][option] === "object")
options[pattern][option] = patterns[shared[pattern].dflt][option];
else if (

View file

@ -42,7 +42,6 @@ for (let pattern of Object.keys(patterns)) {
if (typeof value === "object") options[pattern][option] = value;
else {
if (typeof value === "undefined") {
let inherit = shared[pattern].dflt;
if (typeof patterns[shared[pattern].dflt][option] === "object")
options[pattern][option] = patterns[shared[pattern].dflt][option];
else if (

View file

@ -29,7 +29,7 @@
"pubtest": "npm publish --registry http://localhost:6662",
"pubforce": "npm publish",
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
"prebuild": "node src/prebuild.js"
"NOprebuild": "node src/prebuild.js"
},
"peerDependencies": {
"@freesewing/core": "^2.0.0-alpha.25",

View file

@ -63,7 +63,6 @@ decorate.paths = function(svg) {
for (let pathId in part.paths) {
let path = part.paths[pathId];
if (path.render) {
let id;
let current;
for (let op of path.ops) {
if (op.type !== "close") {

View file

@ -1,4 +1,3 @@
import script from "./lib/script";
import snippets from "./lib/snippets";
import { version, name } from "../package.json";
import decorate from "./decorate";
@ -14,8 +13,7 @@ export default {
// raiseEvent.bind(svg)('plugin-designer-pointHover', evt);
//}
if (svg.attributes.get("freesewing:plugin-designer") === false) {
// Add script and snippets
//svg.script += script;
// Add snippets
svg.defs += snippets;
// Add SVG attributes

View file

@ -21,7 +21,9 @@ export default {
let angle1 = from.angle(via);
let angle2 = via.angle(to);
if ((Math.round(angle1) - Math.round(angle2)) % 90 !== 0)
throw new Error("The round macro currently only supports 90 degree angles.");
throw new Error(
"The round macro currently only supports 90 degree angles."
);
let fd = from.dist(via);
let td = to.dist(via);
if (radius > fd || radius > td || typeof radius === "undefined")
@ -38,7 +40,8 @@ export default {
this.points[prefix + "End"]
)
.attr("class", so.class ? so.class : "");
if(typeof so.render !== undefined && so.render) this.paths[prefix+"Rounded"].render = true;
if (typeof so.render !== "undefined" && so.render)
this.paths[prefix + "Rounded"].render = true;
else this.paths[prefix + "Rounded"].render = false;
}
}

View file

@ -35,7 +35,7 @@ export default {
.clone()
.attr("data-text", so.nr, overwrite)
.attr("data-text-class", "title-nr note fill-note")
.attr("data-text-transform", transform(so.at, so.at));
.attr("data-text-transform", transform(so.at));
let shift = 10;
if (so.title) {
this.points[`_${prefix}_titleName`] = so.at

View file

@ -1,72 +1,86 @@
const validate = {};
validate.point = function(point, partId, pointId, debug) {
if(typeof point !== 'object') {
if (typeof point !== "object") {
debug({
type: "error",
label: 'Problem with point',
label: "Problem with point",
msg: points
});
throw new Error(`Point pattern.parts.${partId}.points.${pointId} is not an object`);
} else if(typeof point.x !== 'number' || isNaN(point.x)) {
throw new Error(
`Point pattern.parts.${partId}.points.${pointId} is not an object`
);
} else if (typeof point.x !== "number" || isNaN(point.x)) {
debug({
type: "error",
label: 'Problem with point X-value',
label: "Problem with point X-value",
msg: points
});
throw new Error(`X-value of point pattern.parts.${partId}.points.${pointId} is not a number`);
} else if(typeof point.y !== 'number' || isNaN(point.y)) {
throw new Error(
`X-value of point pattern.parts.${partId}.points.${pointId} is not a number`
);
} else if (typeof point.y !== "number" || isNaN(point.y)) {
debug({
type: "error",
label: 'Problem with point Y-value',
label: "Problem with point Y-value",
msg: points
});
debug(dbg, 'Problem with point Y-value:', point);
throw new Error(`Y-value of point pattern.parts.${partId}.points.${pointId} is not a number`);
} else if(typeof point.attributes !== 'object' || !point.attributes.clone instanceof Function) {
debug(dbg, "Problem with point Y-value:", point);
throw new Error(
`Y-value of point pattern.parts.${partId}.points.${pointId} is not a number`
);
} else if (
typeof point.attributes !== "object" ||
!(point.attributes.clone instanceof Function)
) {
debug({
type: "error",
label: 'Problem with point attributes',
label: "Problem with point attributes",
msg: points
});
throw new Error (dbg, `attributes property of point pattern.parts.${partId}.points.${pointId} is not an object`);
} else if(!point.clone instanceof Function) {
throw new Error(
`attributes property of point pattern.parts.${partId}.points.${pointId} is not an object`
);
} else if (!(point.clone instanceof Function)) {
debug({
type: "error",
label: 'Problem with point',
label: "Problem with point",
msg: points
});
throw new Error(`Point pattern.parts.${partId}.points.${pointId} is not a valid Point object`);
throw new Error(
`Point pattern.parts.${partId}.points.${pointId} is not a valid Point object`
);
}
return true;
}
};
validate.text = function(type, item, partId, itemId, debug) {
let text = item.attributes.getAsArray('data-text');
let text = item.attributes.getAsArray("data-text");
if (text === false) return true;
else {
if(item.attributes.get('data-validate-skip-text') !== false) {
if (item.attributes.get("data-validate-skip-text") !== false) {
debug({
type: "warning",
label: '🌐 Possible translation issue',
label: "🌐 Possible translation issue",
msg: `This text might be a translation problem:, ${item} However, the error was suppresed, so moving on.`
});
return true;
}
for (let t of text) {
if(typeof t !== 'string' && typeof t !== 'number') {
if (typeof t !== "string" && typeof t !== "number") {
debug({
type: "error",
label: 'This text is not a string or number',
label: "This text is not a string or number",
msg: t
});
throw new Error(`${type} pattern.parts.${partId}.${type}s.${itemId} has text that is not a string nor a number. Set the 'data-validate-skip-text' attribute to true to suppress this error.`);
} else if(typeof t === 'string' && t.indexOf(' ') !== -1) {
throw new Error(
`${type} pattern.parts.${partId}.${type}s.${itemId} has text that is not a string nor a number. Set the 'data-validate-skip-text' attribute to true to suppress this error.`
);
} else if (typeof t === "string" && t.indexOf(" ") !== -1) {
debug({
type: "warning",
label: '🌐 Possible translation issue',
label: "🌐 Possible translation issue",
msg: t
});
debug({
@ -78,93 +92,111 @@ validate.text = function (type, item, partId, itemId, debug) {
}
}
return true;
}
};
validate.path = function(path, partId, pathId, debug) {
if(typeof path !== 'object') {
if (typeof path !== "object") {
debug({
type: "error",
label: 'Problem with path',
label: "Problem with path",
msg: path
});
throw new Error(`Path pattern.parts.${partId}.paths.${pathId} is not an object`);
} else if(typeof path.ops !== 'object') {
throw new Error(
`Path pattern.parts.${partId}.paths.${pathId} is not an object`
);
} else if (typeof path.ops !== "object") {
debug({
type: "error",
label: 'Problem with path ops',
label: "Problem with path ops",
msg: path
});
throw new Error(`ops property of path pattern.parts.${partId}.paths.${pathId} is not an object`);
throw new Error(
`ops property of path pattern.parts.${partId}.paths.${pathId} is not an object`
);
} else if (path.ops.length < 2) {
debug({
type: "error",
label: 'Problem with path ops',
label: "Problem with path ops",
msg: path
});
throw new Error(`Path pattern.parts.${partId}.paths.${pathId} does not do anything`);
} else if(typeof path.attributes !== 'object') {
throw new Error(
`Path pattern.parts.${partId}.paths.${pathId} does not do anything`
);
} else if (typeof path.attributes !== "object") {
debug({
type: "error",
label: 'Problem with path attributes',
label: "Problem with path attributes",
msg: path
});
throw new Error(`attributes property of path pattern.parts.${partId}.paths.${pathId} is not an object`);
} else if(!path.clone instanceof Function) {
throw new Error(
`attributes property of path pattern.parts.${partId}.paths.${pathId} is not an object`
);
} else if (!(path.clone instanceof Function)) {
debug({
type: "error",
label: 'Problem with path',
label: "Problem with path",
msg: path
});
throw new Error(`Path pattern.parts.${partId}.paths.${pathId} is not a valid Path object`);
} else if(!path.attributes.clone instanceof Function) {
throw new Error(
`Path pattern.parts.${partId}.paths.${pathId} is not a valid Path object`
);
} else if (!(path.attributes.clone instanceof Function)) {
debug({
type: "error",
label: 'Problem with path attributes',
label: "Problem with path attributes",
msg: path
});
throw new Error(`attributes property of path pattern.parts.${partId}.paths.${pathId} is not a valid Attributes object`);
throw new Error(
`attributes property of path pattern.parts.${partId}.paths.${pathId} is not a valid Attributes object`
);
}
for (let o in path.ops) {
let op = path.ops[o];
if(op.type !== 'close') {
if(!validate.point(op.to, partId, '_unknown_', debug)) {
if (op.type !== "close") {
if (!validate.point(op.to, partId, "_unknown_", debug)) {
debug({
type: "error",
label: 'Problem with path TO point',
label: "Problem with path TO point",
msg: op.to
});
throw new Error(`Point in pattern.parts.${partId}.paths.${pathId}.ops[o].to is not a valid Point object`);
throw new Error(
`Point in pattern.parts.${partId}.paths.${pathId}.ops[o].to is not a valid Point object`
);
}
} else if (op.type === 'curve') {
if(!validate.point(op.cp1, partId, '_unknown_', debug)) {
} else if (op.type === "curve") {
if (!validate.point(op.cp1, partId, "_unknown_", debug)) {
debug({
type: "error",
label: 'Problem with path CP1 point',
label: "Problem with path CP1 point",
msg: op.cp1
});
throw new Error(`Point in pattern.parts.${partId}.paths.${pathId}.ops[o].cp1 is not a valid Point object`);
} else if(!validate.point(op.cp2, partId, '_unknown_', debug)) {
throw new Error(
`Point in pattern.parts.${partId}.paths.${pathId}.ops[o].cp1 is not a valid Point object`
);
} else if (!validate.point(op.cp2, partId, "_unknown_", debug)) {
debug({
type: "error",
label: 'Problem with path CP2 point',
label: "Problem with path CP2 point",
msg: op.cp2
});
throw new Error(`Point in pattern.parts.${partId}.paths.${pathId}.ops[o].cp2 is not a valid Point object`);
throw new Error(
`Point in pattern.parts.${partId}.paths.${pathId}.ops[o].cp2 is not a valid Point object`
);
}
}
}
return true;
}
};
validate.snippet = function(snippet, partId, snippetId, debug) {
if(typeof snippet !== 'object') return false;
if(!validate.point(snippet.anchor, partId, '_unknown_', debug)) return false;
if(typeof snippet.attributes !== 'object') return false;
if(!snippet.clone instanceof Function) return false;
if(!snippet.attributes.clone instanceof Function) return false;
if (typeof snippet !== "object") return false;
if (!validate.point(snippet.anchor, partId, "_unknown_", debug)) return false;
if (typeof snippet.attributes !== "object") return false;
if (!(snippet.clone instanceof Function)) return false;
if (!(snippet.attributes.clone instanceof Function)) return false;
return true;
}
};
export default validate;

View file

@ -1,5 +1,5 @@
export default function(part) {
let { options, Point, Path, points, paths, store, macro } = part.shorthand();
let { Point, Path, points, paths, store } = part.shorthand();
let y = store.get("y");
let w = store.get("w");

View file

@ -1,5 +1,5 @@
export default function(part) {
let { options, Point, Path, points, paths, store, macro } = part.shorthand();
let { Point, Path, points, paths, store } = part.shorthand();
let y = store.get("y");
let w = store.get("w");
@ -17,7 +17,7 @@ export default function(part) {
let sizes = ["xs", "sm", "", "l", "xl"];
let utility = ["dotted", "dashed", "lashed", "sa", "help", "hidden"];
for (let i in colors) {
for (let i = 0; i < utility.length; i++) {
y += 15;
points["l" + i] = new Point(0, y);
points["r" + i] = new Point(w, y);
@ -26,7 +26,7 @@ export default function(part) {
.line(points["r" + i])
.attr("class", colors[i])
.attr("data-text", colors[i]);
for (let j in sizes) {
for (let j = 0; j < sizes.length; j++) {
y += 10;
points["sl" + i + j] = new Point(0, y);
points["sr" + i + j] = new Point(w, y);
@ -41,7 +41,7 @@ export default function(part) {
)
.attr("data-text-class", "center");
}
for (let j in utility) {
for (let j = 0; j < utility.length; j++) {
y += 10;
points["ul" + i + j] = new Point(0, y);
points["ur" + i + j] = new Point(w, y);

View file

@ -1,17 +1,5 @@
export default function(part) {
let {
macro,
options,
Point,
Path,
points,
paths,
snippets,
Snippet,
complete,
paperless,
store
} = part.shorthand();
let { macro, Point, Path, points, paths, store } = part.shorthand();
let y = store.get("y");
let w = store.get("w");

View file

@ -1,7 +1,5 @@
export default function(part) {
let {
macro,
options,
Point,
Path,
points,

View file

@ -27,10 +27,10 @@ export default function(part) {
.line(points.trr)
.attr("data-text", "text.right")
.attr("data-text-class", "right");
for (let i in text) {
for (let i = 0; i < text.length; i++) {
y += 15;
points["t" + i] = new Point(0, y)
.attr("data-text", "text" + text[i] === "" ? "" : ".text-" + text[i])
.attr("data-text", "text" + (text[i] === "" ? "" : ".text-" + text[i]))
.attr("data-text-class", "text-" + text[i]);
}
store.set("y", y);

Some files were not shown because too many files have changed in this diff Show more