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' import { backPocket } from './back-pocket.mjs'
function draftCharlieBackPocketFacing (part) { function draftCharlieBackPocketFacing({
// Shorthand points,
let { points, Point, paths, Path, complete, paperless, macro, snippets, sa } = part.shorthand() Point,
paths,
Path,
complete,
paperless,
macro,
snippets,
sa,
part,
}) {
// Clean up // Clean up
delete paths.fold delete paths.fold
delete snippets.logo delete snippets.logo

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,24 +3,22 @@ import { back } from './back.mjs'
import { front as titanFront } from '@freesewing/titan' import { front as titanFront } from '@freesewing/titan'
import { back as titanBack } from '@freesewing/titan' import { back as titanBack } from '@freesewing/titan'
function draftCharlieWaistband (part) { function draftCharlieWaistband({
// Shorthand points,
let { Point,
points, paths,
Point, Path,
paths, options,
Path, complete,
options, paperless,
complete, store,
paperless, macro,
store, snippets,
macro, Snippet,
snippets, sa,
Snippet, absoluteOptions,
sa, part,
absoluteOptions, }) {
} = part.shorthand()
store.set('waistbandWidth', absoluteOptions.waistbandWidth) store.set('waistbandWidth', absoluteOptions.waistbandWidth)
if (options.waistbandCurve > 0) { if (options.waistbandCurve > 0) {
@ -143,7 +141,7 @@ function draftCharlieWaistband (part) {
export const waistband = { export const waistband = {
name: 'charlie.waistband', name: 'charlie.waistband',
after: [ titanBack, titanFront, back, front ], after: [titanBack, titanFront, back, front],
options: { options: {
waistbandCurve: { pct: 0, min: 0, max: 35, menu: 'fit' }, waistbandCurve: { pct: 0, min: 0, max: 35, menu: 'fit' },
}, },