1
0
Fork 0

chore(huey): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 14:36:26 +02:00
parent c89e5e9569
commit 538fc7f414
9 changed files with 82 additions and 52 deletions

View file

@ -2,10 +2,20 @@ import { pluginBundle } from '@freesewing/plugin-bundle'
import { back as brianBack } from '@freesewing/brian' import { back as brianBack } from '@freesewing/brian'
import { sharedDimensions } from './shared.mjs' import { sharedDimensions } from './shared.mjs'
function draftHueyBack (part) { function draftHueyBack({
let { store, macro, Path, Point, points, paths, complete, paperless, sa, options, measurements } = store,
part.shorthand() macro,
Path,
Point,
points,
paths,
complete,
paperless,
sa,
options,
measurements,
part,
}) {
// Clear paths from Brian // Clear paths from Brian
for (let i in paths) { for (let i in paths) {
if (['backArmhole', 'backCollar'].indexOf(i) === -1) delete paths[i] if (['backArmhole', 'backCollar'].indexOf(i) === -1) delete paths[i]
@ -79,12 +89,12 @@ export const back = {
name: 'huey.back', name: 'huey.back',
from: brianBack, from: brianBack,
hideDependencies: true, hideDependencies: true,
measurements: [ 'hips' ], measurements: ['hips'],
options: { options: {
ribbing: { bool: true, menu: 'style' }, ribbing: { bool: true, menu: 'style' },
ribbingHeight: { pct: 10, min: 5, max: 15, menu: 'style' }, ribbingHeight: { pct: 10, min: 5, max: 15, menu: 'style' },
hipsEase: { pct: 8, min: 4, max: 12, menu: 'fit' }, hipsEase: { pct: 8, min: 4, max: 12, menu: 'fit' },
}, },
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftHueyBack, draft: draftHueyBack,
} }

View file

@ -1,8 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { draftRibbing } from './shared.mjs' import { draftRibbing } from './shared.mjs'
function draftHueyCuff (part) { function draftHueyCuff({ complete, points, measurements, options, macro, part }) {
let { complete, points, measurements, options, macro } = part.shorthand()
if (!options.ribbing) return part if (!options.ribbing) return part
draftRibbing(part, measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch)) draftRibbing(part, measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch))
@ -24,6 +23,6 @@ export const cuff = {
options: { options: {
ribbingStretch: { pct: 15, min: 0, max: 30, menu: 'fit' }, ribbingStretch: { pct: 15, min: 0, max: 30, menu: 'fit' },
}, },
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftHueyCuff, draft: draftHueyCuff,
} }

View file

@ -2,10 +2,20 @@ import { front as brianFront } from '@freesewing/brian'
import { back } from './back.mjs' import { back } from './back.mjs'
import { sharedDimensions } from './shared.mjs' import { sharedDimensions } from './shared.mjs'
function draftHueyFront (part) { function draftHueyFront({
let { utils, store, Point, Path, points, paths, complete, paperless, sa, options, measurements } = utils,
part.shorthand() store,
Point,
Path,
points,
paths,
complete,
paperless,
sa,
options,
measurements,
part,
}) {
// Clear paths from Brian // Clear paths from Brian
for (let i in paths) { for (let i in paths) {
if (['frontArmhole', 'frontCollar'].indexOf(i) === -1) delete paths[i] if (['frontArmhole', 'frontCollar'].indexOf(i) === -1) delete paths[i]

View file

@ -1,8 +1,7 @@
import { front } from './front.mjs' import { front } from './front.mjs'
import { back } from './back.mjs' import { back } from './back.mjs'
function draftHueyHood (part) { function draftHueyHood({
let {
store, store,
macro, macro,
Point, Point,
@ -16,8 +15,8 @@ function draftHueyHood (part) {
sa, sa,
options, options,
measurements, measurements,
} = part.shorthand() part,
}) {
let base = store.get('frontNeckSeamLength') + store.get('backNeckSeamLength') let base = store.get('frontNeckSeamLength') + store.get('backNeckSeamLength')
points.cfBottom = new Point(0, 0) points.cfBottom = new Point(0, 0)
points.cbBottom = points.cfBottom.shift(0, base).rotate(options.hoodAngle, points.cfBottom) points.cbBottom = points.cfBottom.shift(0, base).rotate(options.hoodAngle, points.cfBottom)
@ -108,8 +107,8 @@ function draftHueyHood (part) {
export const hood = { export const hood = {
name: 'huey.hood', name: 'huey.hood',
after: [ front, back ], after: [front, back],
measurements: [ 'head' ], measurements: ['head'],
options: { options: {
hoodHeight: { pct: 59, min: 55, max: 65, menu: 'style' }, hoodHeight: { pct: 59, min: 55, max: 65, menu: 'style' },
hoodCutback: { pct: 10, min: 5, max: 15, menu: 'style' }, hoodCutback: { pct: 10, min: 5, max: 15, menu: 'style' },

View file

@ -12,13 +12,8 @@ import { cuff } from './cuff.mjs'
// Create design // Create design
const Huey = new Design({ const Huey = new Design({
data, data,
parts: [ parts: [back, front, sleeve, pocket, hood, waistband, cuff],
back, front, sleeve, pocket, hood, waistband, cuff,
],
}) })
// Named exports // Named exports
export { export { back, front, sleeve, pocket, hood, waistband, cuff, Huey }
back, front, sleeve, pocket, hood, waistband, cuff,
Huey,
}

View file

@ -1,9 +1,18 @@
import { front } from './front.mjs' import { front } from './front.mjs'
function draftHueyPocket (part) { function draftHueyPocket({
let { macro, Path, points, paths, complete, paperless, snippets, Snippet, sa, options } = macro,
part.shorthand() Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa,
options,
part,
}) {
if (!options.pocket) return part if (!options.pocket) return part
// Clear paths and snippets // Clear paths and snippets

View file

@ -1,4 +1,4 @@
export function sharedDimensions (part, s) { export function sharedDimensions(part, s) {
let { macro, Point, points, sa } = part.shorthand() let { macro, Point, points, sa } = part.shorthand()
if (s === 'front') { if (s === 'front') {
@ -80,7 +80,7 @@ export function sharedDimensions (part, s) {
}) })
} }
export function draftRibbing (part, length) { export function draftRibbing(part, length) {
let { let {
store, store,
measurements, measurements,

View file

@ -1,10 +1,19 @@
import { sleeve as brianSleeve } from '@freesewing/brian' import { sleeve as brianSleeve } from '@freesewing/brian'
import { back } from './back.mjs' import { back } from './back.mjs'
function draftHueySleeve (part) { function draftHueySleeve({
let { Point, Path, points, paths, store, options, complete, sa, paperless, macro } = Point,
part.shorthand() Path,
points,
paths,
store,
options,
complete,
sa,
paperless,
macro,
part,
}) {
// Clear paths from Brian, but keep sleevecap // Clear paths from Brian, but keep sleevecap
for (let p of Object.keys(paths)) { for (let p of Object.keys(paths)) {
if (p !== 'sleevecap') delete paths[p] if (p !== 'sleevecap') delete paths[p]

View file

@ -1,8 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { draftRibbing } from './shared.mjs' import { draftRibbing } from './shared.mjs'
function draftHueyWaistband (part) { function draftHueyWaistband({ complete, points, measurements, options, macro, part }) {
let { complete, points, measurements, options, macro } = part.shorthand()
if (!options.ribbing) return part if (!options.ribbing) return part
draftRibbing(part, measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch)) draftRibbing(part, measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch))
@ -23,6 +22,6 @@ export const waistband = {
options: { options: {
ribbingStretch: { pct: 15, min: 0, max: 30, menu: 'fit' }, ribbingStretch: { pct: 15, min: 0, max: 30, menu: 'fit' },
}, },
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftHueyWaistband, draft: draftHueyWaistband,
} }