diff --git a/packages/models/package.json b/packages/models/package.json index f64f8e9fd4c..f8785ced0a5 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -27,15 +27,15 @@ ".": "./dist/index.mjs" }, "scripts": { - "build": "node --experimental-json-modules build.mjs", + "build": "node build.mjs", "clean": "rimraf dist", - "mbuild": "NO_MINIFY=1 node --experimental-json-modules build.mjs", + "mbuild": "NO_MINIFY=1 node build.mjs", "symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -", "test": "npx mocha tests/*.test.mjs", - "vbuild": "VERBOSE=1 node --experimental-json-modules build.mjs", + "vbuild": "VERBOSE=1 node build.mjs", "lab": "cd ../../sites/lab && yarn start", "tips": "node ../../scripts/help.mjs", - "cibuild_step6": "node --experimental-json-modules build.mjs" + "cibuild_step6": "node build.mjs" }, "peerDependencies": { "@freesewing/utils": "^3.0.0-alpha.0" diff --git a/packages/models/pkg.mjs b/packages/models/pkg.mjs new file mode 100644 index 00000000000..14fd5da1114 --- /dev/null +++ b/packages/models/pkg.mjs @@ -0,0 +1,4 @@ +// This file is auto-generated | All changes you make will be overwritten. +export const name = "@freesewing/models" +export const version = "3.0.0-alpha.0" + diff --git a/packages/models/src/neckstimate.mjs b/packages/models/src/neckstimate.mjs index 959a0ea9b55..a348eca4686 100644 --- a/packages/models/src/neckstimate.mjs +++ b/packages/models/src/neckstimate.mjs @@ -2,6 +2,7 @@ * This completes the list of measurements with the ones * we can calculate based on what we already have */ +/* function complete(m) { // Added by plugin-bust: m.bust = m.chest @@ -19,7 +20,7 @@ function complete(m) { return m } - +*/ /* * These are a set of measurements of an average-sized [woman, man]. @@ -29,7 +30,7 @@ function complete(m) { * but we are not in the business of standard sizes, so this will do. */ -const base = complete({ +const base = { ankle: [245, 235], biceps: [270, 350], bustFront: [480, 560], // FIXME: Estimate @@ -65,10 +66,12 @@ const base = complete({ waistToHips: [125, 130], waistToKnee: [600, 640], waistToSeat: [250, 270], - waistToUnderbust: [80, ], + waistToUnderbust: [80, 55], // FIXME: Estimate waistToUpperLeg: [285, 340], wrist: [165, 175], -}) +} +// Add auto-calculated measures +//const full = complete(base) /* * Since linear measurements don't scale the same as circumference @@ -80,8 +83,10 @@ let v = 0.65 // vertical const ratio = { // Arc measurements bustFront: a, + bustBack: a, bustPointToUnderbust: a, bustSpan: a, + highBustBack: a, highBustFront: a, // Circumference measurements ankle: c, @@ -96,26 +101,34 @@ const ratio = { hpsToBust: v, hpsToWaistBack: v, hpsToWaistFront: v, + waistToArmhole: v, waistToHips: v, waistToKnee: v, waistToSeat: v, waistToUnderbust: v, waistToUpperLeg: v, // Other - seatBack: 0.6, - waistBack: 0.85, crossSeam: 0.6, - crossSeamFront: 0.3, + crossSeamFront: 0.6, + crossSeamBack: 0.6, head: 0.35, heel: 0.25, inseam: 0.25, knee: 0.65, seat: 0.6, + seatBack: 0.6, + seatBackArc: 0.6, + seatFront: 0.6, + seatFrontArc: 0.6, shoulderToElbow: 0.5, shoulderToShoulder: 0.65, shoulderToWrist: 0.3, upperLeg: 0.45, waist: 0.85, + waistBack: 0.85, + waistBackArc: 0.85, + waistFront: 0.85, + waistFrontArc: 0.85, waistToFloor: 0.4, wrist: 0.5 } @@ -143,7 +156,7 @@ export const neckstimate = (neck = false, measurement = false, breasts = false, const i = breasts ? 0 : 1 // Shoulder slope is in degrees. Always return the base. - if (measurement === 'shoulderSlope') base.shoulderSlope[i] + if (measurement === 'shoulderSlope') return base.shoulderSlope[i] if (!neck) throw new Error('neckstimate() requires a neck measurement in mm as first parameter') diff --git a/packages/models/tests/models.test.mjs b/packages/models/tests/models.test.mjs index a89fe6688f9..09aee342e80 100644 --- a/packages/models/tests/models.test.mjs +++ b/packages/models/tests/models.test.mjs @@ -13,14 +13,15 @@ describe('Measurements', () => { }) for (const type in sizes) { - describe(`Sizes: ${type}`, () => { - for (const size of sizes[type]) { - it(`${type}${size} should have all measurements`, () => { - for (const m of measurements) { - expect(typeof all[`${type}${size}`][m]).to.equal('number'); - } - }) - } - }) + for (const size of sizes[type]) { + describe(`${type} size ${size}`, () => { + for (const m of measurements) { + it(`${type}${size} should have the ${m} measurement`, () => { + expect(typeof all[`${type}${size}`][m]).to.equal('number') + expect(isNaN(all[`${type}${size}`][m])).to.equal(false) + }) + } + }) + } }