1
0
Fork 0

Port Charlie to v3. Investigating issue.

This commit is contained in:
Benjamin F 2022-09-04 19:50:20 -07:00
parent 4f0e45cc75
commit be1dfad45b
15 changed files with 251 additions and 214 deletions

View file

@ -1,154 +0,0 @@
import pkg from '../package.json' assert { type: 'json' }
import configHelpers from '@freesewing/config-helpers'
const { elastics, pctBasedOn } = configHelpers
const { version } = pkg
export default {
version,
name: 'charlie',
design: 'Joost De Cock',
code: 'Joost De Cock',
department: 'bottoms',
type: 'pattern',
difficulty: 3,
optionGroups: {
fit: ['seatEase', 'kneeEase', 'waistEase', 'waistbandCurve'],
style: ['waistHeight', 'waistbandWidth', 'lengthBonus', 'crotchDrop'],
pockets: [
{
backPockets: [
'backPocketHorizontalPlacement',
'backPocketVerticalPlacement',
'backPocketWidth',
'backPocketDepth',
'backPocketFacing',
],
frontPockets: [
'frontPocketSlantDepth',
'frontPocketSlantWidth',
'frontPocketSlantRound',
'frontPocketSlantBend',
'frontPocketWidth',
'frontPocketDepth',
'frontPocketFacing',
],
},
],
advanced: [
'crossSeamCurveStart',
'crossSeamCurveBend',
'crossSeamCurveAngle',
'crotchSeamCurveStart',
'crotchSeamCurveBend',
'crotchSeamCurveAngle',
'grainlinePosition',
'legBalance',
'waistBalance',
'beltLoops',
{
fly: ['flyCurve', 'flyLength', 'flyWidth'],
},
],
},
measurements: [
'crossSeam',
'crossSeamFront',
'knee',
'seat',
'seatBack',
'waist',
'waistBack',
'waistToFloor',
'waistToKnee',
'waistToHips',
'waistToSeat',
'waistToUpperLeg',
],
hide: ['titanBack', 'titanFront'],
inject: {
back: 'titanBack',
front: 'titanFront',
frontPocket: 'front',
frontPocketFacing: 'frontPocket',
backPocketFacing: 'backPocket',
backPocketInterfacing: 'backPocket',
backPocketWelt: 'backPocketFacing',
flyFacing: 'front',
flyExtension: 'flyFacing',
},
parts: ['beltLoops'],
dependencies: {
// The inheritance makes this a bit messy
titanFront: 'titanBack',
back: ['titanBack', 'titanFront', 'front'],
waistband: ['titanBack', 'titanFront', 'front', 'back'],
waistbandCurved: ['titanBack', 'titanFront', 'front', 'back'],
beltLoops: 'waistband',
backPocket: 'back',
},
options: {
// Constants (from Titan)
titanPaperless: true,
fitCrossSeam: true,
fitCrossSeamFront: true,
fitCrossSeamBack: true,
fitGuides: false,
// Lock titan options
fitKnee: true,
// Charlie constants
waistbandReduction: 0.25, // See src/index.js
waistbandFactor: 0.1,
// Fit (Charlie)
waistbandCurve: { pct: 0, min: 0, max: 35 },
// Fit (from Titan)
waistEase: { pct: 1, min: 0, max: 5 },
seatEase: { pct: 5, min: 0, max: 10 },
kneeEase: { pct: 15, min: 10, max: 30 },
// Style (from Titan)
waistHeight: { pct: -4, min: -15, max: 40 },
waistbandWidth: { pct: 3, min: 1, max: 6, snap: elastics, ...pctBasedOn('waistToFloor') },
//waistbandWidth: { pct: 3.5, min: 2, max: 5 },
lengthBonus: { pct: 2, min: -20, max: 10 },
crotchDrop: { pct: 2, min: 0, max: 15 },
// Advanced (from Titan)
legBalance: { pct: 57.5, min: 52.5, max: 62.5 },
crossSeamCurveStart: { pct: 85, min: 60, max: 100 },
crossSeamCurveBend: { pct: 65, min: 45, max: 85 },
crossSeamCurveAngle: { deg: 12, min: 0, max: 20 },
crotchSeamCurveStart: { pct: 80, min: 60, max: 95 },
crotchSeamCurveBend: { pct: 80, min: 45, max: 100 },
crotchSeamCurveAngle: { deg: 25, min: 0, max: 35 },
waistBalance: { pct: 55, min: 30, max: 90 },
grainlinePosition: { pct: 50, min: 30, max: 60 },
// Back pockets
backPocketVerticalPlacement: { pct: 24, min: 18, max: 30 },
backPocketHorizontalPlacement: { pct: 55, min: 48, max: 62 },
backPocketWidth: { pct: 55, min: 50, max: 60 },
backPocketDepth: { pct: 60, min: 40, max: 80 },
backPocketFacing: { bool: true },
// Front pockets
frontPocketSlantDepth: { pct: 85, min: 70, max: 100 },
frontPocketSlantWidth: { pct: 25, min: 15, max: 35 },
frontPocketSlantRound: { pct: 30, min: 5, max: 50 },
frontPocketSlantBend: { pct: 25, min: 5, max: 50 },
frontPocketWidth: { pct: 55, min: 45, max: 65 },
frontPocketDepth: { pct: 100, min: 85, max: 110 },
frontPocketFacing: { pct: 45, min: 25, max: 65 },
// Fly
flyCurve: { pct: 72, min: 50, max: 100 },
flyLength: { pct: 45, min: 30, max: 60 },
flyWidth: { pct: 15, min: 10, max: 20 },
// Waistband
beltLoops: { count: 8, min: 6, max: 12 },
},
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { backPocket } from './back-pocket.mjs'
function draftCharlieBackPocketFacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, macro, snippets, sa } = part.shorthand()
@ -65,3 +67,9 @@ export default (part) => {
return part
}
export const backPocketFacing = {
name: 'charlie.backPocketFacing',
from: backPocket,
draft: draftCharlieBackPocketFacing,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { backPocket } from './back-pocket.mjs'
function draftCharlieBackPocketInterfacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, macro, snippets } = part.shorthand()
@ -56,3 +58,9 @@ export default (part) => {
return part
}
export const backPocketInterfacing = {
name: 'charlie.backPocketInterfacing',
from: backPocket,
draft: draftCharlieBackPocketInterfacing,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { backPocketFacing } from './back-pocket-facing.mjs'
function draftCharlieBackPocketWelt (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, macro, snippets } = part.shorthand()
@ -60,3 +62,9 @@ export default (part) => {
return part
}
export const backPocketWelt = {
name: 'charlie.backPocketWelt',
from: backPocketFacing,
draft: draftCharlieBackPocketWelt,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { back } from './back.mjs'
function draftCharlieBackPocket (part) {
// Shorthand
let { points, Point, paths, Path, complete, paperless, store, macro, snippets, Snippet, sa } =
part.shorthand()
@ -90,3 +92,9 @@ export default (part) => {
return part
}
export const backPocket = {
name: 'charlie.backPocket',
after: back,
draft: draftCharlieBackPocket,
}

View file

@ -1,4 +1,8 @@
export default (part) => {
import { back as titanBack } from '@freesewing/titan'
import { front } from './front.mjs'
import { front as titanFront } from '@freesewing/titan'
function draftCharlieBack (part) {
// Helper method to draw the outseam path
const drawOutseam = () => {
let outseam = new Path()
@ -303,3 +307,22 @@ export default (part) => {
return part
}
export const back = {
name: 'charlie.back',
from: titanBack,
after: [ titanBack, titanFront, 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' },
backPocketFacing: { bool: true, menu: 'pockets.backpockets' },
},
draft: draftCharlieBack,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { waistband } from './waistband.mjs'
function draftCharlieBeltLoops (part) {
// Shorthand
let { store, points, Point, paths, Path, options, complete, paperless, macro, sa } =
part.shorthand()
@ -72,3 +74,12 @@ export default (part) => {
return part
}
export const beltLoops = {
name: 'charlie.beltLoops',
after: waistband,
options: {
beltLoops: { count: 8, min: 6, max: 12, menu: 'advanced' },
},
draft: draftCharlieBeltLoops,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { flyFacing } from './fly-facing.mjs'
function draftCharlieFlyExtension (part) {
// Shorthand
let { points, paths, Path, complete, macro, sa } = part.shorthand()
@ -58,3 +60,9 @@ export default (part) => {
return part
}
export const flyExtension = {
name: 'charlie.flyExtension',
from: flyFacing,
draft: draftCharlieFlyExtension,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { front } from './front.mjs'
function draftCharlieFlyFacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, macro, snippets, sa } = part.shorthand()
@ -47,3 +49,9 @@ export default (part) => {
return part
}
export const flyFacing = {
name: 'charlie.flyFacing',
from: front,
draft: draftCharlieFlyFacing,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { frontPocket } from './front-pocket.mjs'
function draftCharlieFrontPocketFacing (part) {
// Shorthand
let { points, Point, paths, Path, complete, macro, snippets, sa } = part.shorthand()
@ -46,3 +48,9 @@ export default (part) => {
return part
}
export const frontPocketFacing = {
name: 'charlie.frontPocketFacing',
from: frontPocket,
draft: draftCharlieFrontPocketFacing,
}

View file

@ -1,4 +1,6 @@
export default (part) => {
import { front } from './front.mjs'
function draftCharlieFrontPocket (part) {
// Shorthand
let { points, paths, Path, complete, paperless, macro, snippets, Snippet, sa } = part.shorthand()
@ -70,3 +72,9 @@ export default (part) => {
return part
}
export const frontPocket = {
name: 'charlie.frontPocket',
from: front,
draft: draftCharlieFrontPocket,
}

View file

@ -1,4 +1,8 @@
export default (part) => {
import { elastics } from '@freesewing/snapseries'
import { pctBasedOn } from '@freesewing/core'
import { front as titanFront } from '@freesewing/titan'
function draftCharlieFront (part) {
// Helper method to draw the outseam path
const drawOutseam = () =>
new Path()
@ -345,3 +349,85 @@ export default (part) => {
return part
}
export const front = {
name: 'charlie.front',
from: titanFront,
hideDependencies: true,
measurements: [
'crossSeam',
'crossSeamFront',
'knee',
'seat',
'seatBack',
'waist',
'waistBack',
'waistToFloor',
'waistToKnee',
'waistToHips',
'waistToSeat',
'waistToUpperLeg',
],
options: {
// Constants (from Titan)
titanPaperless: true,
fitCrossSeam: true,
fitCrossSeamFront: true,
fitCrossSeamBack: true,
fitGuides: false,
// Lock titan options
fitKnee: true,
// Charlie constants
waistbandReduction: 0.25, // See src/index.js
waistbandFactor: 0.1,
// Fit (from Titan)
waistEase: { pct: 1, min: 0, max: 5, menu: 'fit' },
seatEase: { pct: 5, min: 0, max: 10, menu: 'fit' },
kneeEase: { pct: 15, min: 10, max: 30, menu: 'fit' },
// 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.5, min: 2, max: 5 },
lengthBonus: { pct: 2, min: -20, max: 10, menu: 'style' },
crotchDrop: { pct: 2, min: 0, max: 15, menu: 'style' },
// Advanced (from Titan)
crossSeamCurveStart: { pct: 85, min: 60, max: 100, menu: 'advanced' },
crossSeamCurveBend: { pct: 65, min: 45, max: 85, menu: 'advanced' },
crossSeamCurveAngle: { deg: 12, min: 0, max: 20, menu: 'advanced' },
crotchSeamCurveStart: { pct: 80, min: 60, max: 95, menu: 'advanced' },
crotchSeamCurveBend: { pct: 80, min: 45, max: 100, menu: 'advanced' },
crotchSeamCurveAngle: { deg: 25, min: 0, max: 35, menu: 'advanced' },
grainlinePosition: { pct: 50, min: 30, max: 60, menu: 'advanced' },
legBalance: { pct: 57.5, min: 52.5, max: 62.5, menu: 'advanced' },
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' },
// 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

@ -1,52 +1,34 @@
import freesewing from '@freesewing/core'
import Titan from '@freesewing/titan'
import plugins from '@freesewing/plugin-bundle'
import mirrorPlugin from '@freesewing/plugin-mirror'
import buttonsPlugin from '@freesewing/plugin-buttons'
import bartackPlugin from '@freesewing/plugin-bartack'
import config from '../config'
import { Design } from '@freesewing/core'
import { data } from '../data.mjs'
// Parts
import draftBack from './back'
import draftFront from './front'
import draftWaistband from './waistband'
import draftWaistbandCurved from './waistband-curved'
import draftFrontPocket from './front-pocket'
import draftFrontPocketFacing from './front-pocket-facing'
import draftBackPocket from './back-pocket'
import draftBackPocketFacing from './back-pocket-facing'
import draftBackPocketInterfacing from './back-pocket-interfacing'
import draftBackPocketWelt from './back-pocket-welt'
import draftFlyFacing from './fly-facing'
import draftFlyExtension from './fly-extension'
import draftBeltLoops from './beltloops'
import { back } from './back.mjs'
import { front } from './front.mjs'
import { waistband } from './waistband.mjs'
import { waistbandCurved } from './waistband-curved.mjs'
import { frontPocket } from './front-pocket.mjs'
import { frontPocketFacing } from './front-pocket-facing.mjs'
import { backPocket } from './back-pocket.mjs'
import { backPocketFacing } from './back-pocket-facing.mjs'
import { backPocketInterfacing } from './back-pocket-interfacing.mjs'
import { backPocketWelt } from './back-pocket-welt.mjs'
import { flyFacing } from './fly-facing.mjs'
import { flyExtension } from './fly-extension.mjs'
import { beltLoops } from './beltloops.mjs'
// Create design
const Charlie = new freesewing.Design(config, [plugins, mirrorPlugin, buttonsPlugin, bartackPlugin])
// Attach titan draft methods to prototype
for (let p of ['Front', 'Back']) {
Charlie.prototype[`draftTitan${p}`] = function (part) {
return new Titan(this.settings)[`draft${p}`](part)
}
}
// Attach charlie draft methods to prototype
Charlie.prototype.draftBack = (part) => draftBack(part)
Charlie.prototype.draftFront = (part) => draftFront(part)
Charlie.prototype.draftWaistband = (part) => draftWaistband(part)
Charlie.prototype.draftWaistbandCurved = (part) => draftWaistbandCurved(part)
Charlie.prototype.draftFrontPocket = (part) => draftFrontPocket(part)
Charlie.prototype.draftFrontPocketFacing = (part) => draftFrontPocketFacing(part)
Charlie.prototype.draftBackPocket = (part) => draftBackPocket(part)
Charlie.prototype.draftBackPocketFacing = (part) => draftBackPocketFacing(part)
Charlie.prototype.draftBackPocketInterfacing = (part) => draftBackPocketInterfacing(part)
Charlie.prototype.draftBackPocketWelt = (part) => draftBackPocketWelt(part)
Charlie.prototype.draftFlyFacing = (part) => draftFlyFacing(part)
Charlie.prototype.draftFlyExtension = (part) => draftFlyExtension(part)
Charlie.prototype.draftBeltLoops = (part) => draftBeltLoops(part)
const Charlie = new Design({
data,
parts: [
front, back, waistband, waistbandCurved, frontPocket, frontPocketFacing,
backPocket, backPocketFacing, backPocketInterfacing, backPocketWelt,
flyFacing, flyExtension, beltLoops,
],
})
// Named exports
export { config, Charlie }
// Default export
export default Charlie
export {
front, back, waistband, waistbandCurved, frontPocket, frontPocketFacing,
backPocket, backPocketFacing, backPocketInterfacing, backPocketWelt,
flyFacing, flyExtension, beltLoops,
Charlie,
}

View file

@ -1,4 +1,9 @@
export default (part) => {
import { front } from './front.mjs'
import { back } from './back.mjs'
import { front as titanFront } from '@freesewing/titan'
import { back as titanBack } from '@freesewing/titan'
function draftCharlieWaistbandCurved (part) {
// Shorthand
let {
points,
@ -284,3 +289,9 @@ export default (part) => {
return part
}
export const waistbandCurved = {
name: 'charlie.waistbandCurved',
after: [ titanBack, titanFront, front, back ],
draft: draftCharlieWaistbandCurved,
}

View file

@ -1,4 +1,9 @@
export default (part) => {
import { front } from './front.mjs'
import { back } from './back.mjs'
import { front as titanFront } from '@freesewing/titan'
import { back as titanBack } from '@freesewing/titan'
function draftCharlieWaistband (part) {
// Shorthand
let {
points,
@ -135,3 +140,12 @@ export default (part) => {
return part
}
export const waistband = {
name: 'charlie.waistband',
after: [ titanBack, titanFront, back, front ],
options: {
waistbandCurve: { pct: 0, min: 0, max: 35, menu: 'fit' },
},
draft: draftCharlieWaistband,
}