1
0
Fork 0

chore(charlie): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 13:58:31 +02:00
parent 9f487c2220
commit a47eb1a42b
14 changed files with 216 additions and 154 deletions

View file

@ -1,9 +1,17 @@
import { backPocket } from './back-pocket.mjs'
function draftCharlieBackPocketFacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, macro, snippets, sa } = part.shorthand()
function draftCharlieBackPocketFacing({
points,
Point,
paths,
Path,
complete,
paperless,
macro,
snippets,
sa,
part,
}) {
// Clean up
delete paths.fold
delete snippets.logo

View file

@ -1,9 +1,16 @@
import { backPocket } from './back-pocket.mjs'
function draftCharlieBackPocketInterfacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, macro, snippets } = part.shorthand()
function draftCharlieBackPocketInterfacing({
points,
Point,
paths,
Path,
complete,
paperless,
macro,
snippets,
part,
}) {
// Clean up
for (let id in paths) delete paths[id]
delete snippets.logo

View file

@ -1,9 +1,16 @@
import { backPocketFacing } from './back-pocket-facing.mjs'
function draftCharlieBackPocketWelt (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, macro, snippets } = part.shorthand()
function draftCharlieBackPocketWelt({
points,
Point,
paths,
Path,
complete,
paperless,
macro,
snippets,
part,
}) {
// Clean up
for (let id in paths) delete paths[id]
delete snippets.logo

View file

@ -1,10 +1,19 @@
import { back } from './back.mjs'
function draftCharlieBackPocket (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, store, macro, snippets, Snippet, sa } =
part.shorthand()
function draftCharlieBackPocket({
points,
Point,
paths,
Path,
complete,
paperless,
store,
macro,
snippets,
Snippet,
sa,
part,
}) {
points.leftNotch = new Point(store.get('backPocketWidth') / -2, 0)
points.rightNotch = points.leftNotch.flipX()
points.waistbandLeft = new Point(points.leftNotch.x, store.get('backPocketToWaistband') * -1)

View file

@ -1,7 +1,23 @@
import { back as titanBack } from '@freesewing/titan'
import { front } from './front.mjs'
function draftCharlieBack (part) {
function draftCharlieBack({
points,
Point,
paths,
Path,
options,
complete,
paperless,
store,
macro,
snippets,
Snippet,
sa,
log,
units,
part,
}) {
// Helper method to draw the outseam path
const drawOutseam = () => {
let outseam = new Path()
@ -29,24 +45,6 @@ function draftCharlieBack (part) {
.curve(points.forkCp2, points.kneeInCp1, points.floorIn)
}
// Shorthand
let {
points,
Point,
paths,
Path,
options,
complete,
paperless,
store,
macro,
snippets,
Snippet,
sa,
raise,
units,
} = part.shorthand()
// Mark back pocket
let base = points.styleWaistIn.dist(points.styleWaistOut)
let angle = points.styleWaistIn.angle(points.styleWaistOut)
@ -191,7 +189,7 @@ function draftCharlieBack (part) {
.close()
.attr('class', 'fabric sa')
}
raise.info(
log.info(
`Inseam height: ${units(points.fork.dy(points.floorIn))} | ` +
`Waist: ${units((store.get('waistbandBack') + store.get('waistbandFront')) * 2)} | ` +
`Bottom leg width: ${units((store.get('legWidthBack') + store.get('legWidthFront')) / 2)}`
@ -313,14 +311,10 @@ export const back = {
after: front,
hideDependencies: true,
options: {
backPocketVerticalPlacement: { pct: 24, min: 18, max: 30,
menu: 'pockets.backpockets' },
backPocketHorizontalPlacement: { pct: 55, min: 48, max: 62,
menu: 'pockets.backpockets' },
backPocketWidth: { pct: 55, min: 50, max: 60,
menu: 'pockets.backpockets' },
backPocketDepth: { pct: 60, min: 40, max: 80,
menu: 'pockets.backpockets' },
backPocketVerticalPlacement: { pct: 24, min: 18, max: 30, menu: 'pockets.backpockets' },
backPocketHorizontalPlacement: { pct: 55, min: 48, max: 62, menu: 'pockets.backpockets' },
backPocketWidth: { pct: 55, min: 50, max: 60, menu: 'pockets.backpockets' },
backPocketDepth: { pct: 60, min: 40, max: 80, menu: 'pockets.backpockets' },
backPocketFacing: { bool: true, menu: 'pockets.backpockets' },
},
draft: draftCharlieBack,

View file

@ -1,10 +1,18 @@
import { waistband } from './waistband.mjs'
function draftCharlieBeltLoops (part) {
// Shorthand
let { store, points, Point, paths, Path, options, complete, paperless, macro, sa } =
part.shorthand()
function draftCharlieBeltLoops({
store,
points,
Point,
paths,
Path,
options,
complete,
paperless,
macro,
sa,
part,
}) {
let count = options.beltLoops
let length = store.get('waistbandWidth') * 2.5 * count
let width = store.get('waistbandWidth') / 4

View file

@ -1,9 +1,6 @@
import { flyFacing } from './fly-facing.mjs'
function draftCharlieFlyExtension (part) {
// Shorthand
let { points, paths, Path, complete, macro, sa } = part.shorthand()
function draftCharlieFlyExtension({ points, paths, Path, complete, macro, sa, part }) {
// Clean up
for (let id in paths) delete paths[id]

View file

@ -1,9 +1,16 @@
import { front } from './front.mjs'
function draftCharlieFlyFacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, macro, snippets, sa } = part.shorthand()
function draftCharlieFlyFacing({
points,
Point,
paths,
Path,
complete,
macro,
snippets,
sa,
part,
}) {
// Clean up
for (let id in paths) delete paths[id]
for (let id in snippets) delete snippets[id]

View file

@ -1,9 +1,16 @@
import { frontPocket } from './front-pocket.mjs'
function draftCharlieFrontPocketFacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, macro, snippets, sa } = part.shorthand()
function draftCharlieFrontPocketFacing({
points,
Point,
paths,
Path,
complete,
macro,
snippets,
sa,
part,
}) {
// Clean up
for (let id in paths) delete paths[id]
for (let id in snippets) delete snippets[id]

View file

@ -1,9 +1,17 @@
import { front } from './front.mjs'
function draftCharlieFrontPocket (part) {
// Shorthand
let { points, paths, Path, complete, paperless, macro, snippets, Snippet, sa } = part.shorthand()
function draftCharlieFrontPocket({
points,
paths,
Path,
complete,
paperless,
macro,
snippets,
Snippet,
sa,
part,
}) {
// Clean up
for (let id in paths) delete paths[id]
for (let id in snippets) delete snippets[id]

View file

@ -2,7 +2,23 @@ import { elastics } from '@freesewing/snapseries'
import { pctBasedOn } from '@freesewing/core'
import { front as titanFront } from '@freesewing/titan'
function draftCharlieFront (part) {
function draftCharlieFront({
points,
Point,
paths,
Path,
options,
complete,
paperless,
store,
macro,
utils,
snippets,
Snippet,
sa,
log,
part,
}) {
// Helper method to draw the outseam path
const drawOutseam = () =>
new Path()
@ -23,24 +39,6 @@ function draftCharlieFront (part) {
.join(outseam)
}
// Shorthand
let {
points,
Point,
paths,
Path,
options,
complete,
paperless,
store,
macro,
utils,
snippets,
Snippet,
sa,
raise,
} = part.shorthand()
// Helper object holding the Titan side seam path
const sideSeam =
points.waistOut.x < points.seatOut.x
@ -61,7 +59,7 @@ function draftCharlieFront (part) {
points.cfSeat.shiftFractionTowards(points.crotchSeamCurveCp2, options.flyLength).y
)
if (flyBottom) points.flyBottom = flyBottom
else raise.error('Unable to locate the fly bottom. This draft will fail.')
else log.error('Unable to locate the fly bottom. This draft will fail.')
points.flyBottom = utils.curveIntersectsY(
points.crotchSeamCurveStart,
@ -388,8 +386,14 @@ export const front = {
// Style (from Titan)
waistHeight: { pct: -4, min: -15, max: 40, menu: 'style' },
waistbandWidth: { pct: 3, min: 1, max: 6, snap: elastics,
...pctBasedOn('waistToFloor'), menu: 'style' },
waistbandWidth: {
pct: 3,
min: 1,
max: 6,
snap: elastics,
...pctBasedOn('waistToFloor'),
menu: 'style',
},
//waistbandWidth: { pct: 3.5, min: 2, max: 5 },
lengthBonus: { pct: 2, min: -20, max: 10, menu: 'style' },
crotchDrop: { pct: 2, min: 0, max: 15, menu: 'style' },
@ -406,28 +410,18 @@ export const front = {
waistBalance: { pct: 55, min: 30, max: 90, menu: 'advanced' },
// Front pockets
frontPocketSlantDepth: { pct: 85, min: 70, max: 100,
menu: 'pockets.frontpockets' },
frontPocketSlantWidth: { pct: 25, min: 15, max: 35,
menu: 'pockets.frontpockets' },
frontPocketSlantRound: { pct: 30, min: 5, max: 50,
menu: 'pockets.frontpockets' },
frontPocketSlantBend: { pct: 25, min: 5, max: 50,
menu: 'pockets.frontpockets' },
frontPocketWidth: { pct: 55, min: 45, max: 65,
menu: 'pockets.frontpockets' },
frontPocketDepth: { pct: 100, min: 85, max: 110,
menu: 'pockets.frontpockets' },
frontPocketFacing: { pct: 45, min: 25, max: 65,
menu: 'pockets.frontpockets' },
frontPocketSlantDepth: { pct: 85, min: 70, max: 100, menu: 'pockets.frontpockets' },
frontPocketSlantWidth: { pct: 25, min: 15, max: 35, menu: 'pockets.frontpockets' },
frontPocketSlantRound: { pct: 30, min: 5, max: 50, menu: 'pockets.frontpockets' },
frontPocketSlantBend: { pct: 25, min: 5, max: 50, menu: 'pockets.frontpockets' },
frontPocketWidth: { pct: 55, min: 45, max: 65, menu: 'pockets.frontpockets' },
frontPocketDepth: { pct: 100, min: 85, max: 110, menu: 'pockets.frontpockets' },
frontPocketFacing: { pct: 45, min: 25, max: 65, menu: 'pockets.frontpockets' },
// Fly
flyCurve: { pct: 72, min: 50, max: 100,
menu: 'advanced.fly' },
flyLength: { pct: 45, min: 30, max: 60,
menu: 'advanced.fly' },
flyWidth: { pct: 15, min: 10, max: 20,
menu: 'advanced.fly' },
flyCurve: { pct: 72, min: 50, max: 100, menu: 'advanced.fly' },
flyLength: { pct: 45, min: 30, max: 60, menu: 'advanced.fly' },
flyWidth: { pct: 15, min: 10, max: 20, menu: 'advanced.fly' },
},
draft: draftCharlieFront,
}

View file

@ -19,16 +19,36 @@ import { beltLoops } from './beltloops.mjs'
const Charlie = new Design({
data,
parts: [
front, back, waistband, waistbandCurved, frontPocket, frontPocketFacing,
backPocket, backPocketFacing, backPocketInterfacing, backPocketWelt,
flyFacing, flyExtension, beltLoops,
front,
back,
waistband,
waistbandCurved,
frontPocket,
frontPocketFacing,
backPocket,
backPocketFacing,
backPocketInterfacing,
backPocketWelt,
flyFacing,
flyExtension,
beltLoops,
],
})
// Named exports
export {
front, back, waistband, waistbandCurved, frontPocket, frontPocketFacing,
backPocket, backPocketFacing, backPocketInterfacing, backPocketWelt,
flyFacing, flyExtension, beltLoops,
front,
back,
waistband,
waistbandCurved,
frontPocket,
frontPocketFacing,
backPocket,
backPocketFacing,
backPocketInterfacing,
backPocketWelt,
flyFacing,
flyExtension,
beltLoops,
Charlie,
}

View file

@ -3,9 +3,7 @@ import { back } from './back.mjs'
import { front as titanFront } from '@freesewing/titan'
import { back as titanBack } from '@freesewing/titan'
function draftCharlieWaistbandCurved (part) {
// Shorthand
let {
function draftCharlieWaistbandCurved({
points,
Point,
paths,
@ -15,13 +13,13 @@ function draftCharlieWaistbandCurved (part) {
paperless,
store,
macro,
raise,
log,
snippets,
Snippet,
sa,
units,
} = part.shorthand()
part,
}) {
if (options.waistbandCurve == 0) {
return part
}
@ -93,7 +91,7 @@ function draftCharlieWaistbandCurved (part) {
paths.seam = paths.saBase.clone().attr('class', 'fabric').setRender(true)
if (complete) {
raise.info(`Top of waistband: ${units(paths.waistbandTop.length())}`)
log.info(`Top of waistband: ${units(paths.waistbandTop.length())}`)
macro('sprinkle', {
snippet: 'notch',
on: [

View file

@ -3,9 +3,7 @@ import { back } from './back.mjs'
import { front as titanFront } from '@freesewing/titan'
import { back as titanBack } from '@freesewing/titan'
function draftCharlieWaistband (part) {
// Shorthand
let {
function draftCharlieWaistband({
points,
Point,
paths,
@ -19,8 +17,8 @@ function draftCharlieWaistband (part) {
Snippet,
sa,
absoluteOptions,
} = part.shorthand()
part,
}) {
store.set('waistbandWidth', absoluteOptions.waistbandWidth)
if (options.waistbandCurve > 0) {