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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,18 @@
import { front } from './front.mjs'
function draftHueyPocket (part) {
let { macro, Path, points, paths, complete, paperless, snippets, Snippet, sa, options } =
part.shorthand()
function draftHueyPocket({
macro,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa,
options,
part,
}) {
if (!options.pocket) return part
// 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()
if (s === 'front') {
@ -80,7 +80,7 @@ export function sharedDimensions (part, s) {
})
}
export function draftRibbing (part, length) {
export function draftRibbing(part, length) {
let {
store,
measurements,

View file

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

View file

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