1
0
Fork 0

chore(teagan): Ported to v3

This commit is contained in:
joostdecock 2022-09-03 17:20:29 +02:00
parent cdac5589c0
commit 3e8c23a2ce
5 changed files with 64 additions and 106 deletions

View file

@ -1,60 +0,0 @@
import { config as brianConfig } from '@freesewing/brian'
import pkg from '../package.json' assert { type: 'json' }
const { version } = pkg
const config = {
version,
name: 'teagan',
design: 'Joost De Cock',
code: 'Joost De Cock',
department: 'tops',
type: 'pattern',
difficulty: 2,
optionGroups: {
fit: ['chestEase', 'hipsEase', 'sleeveEase', 'draftForHighBust'],
style: ['necklineWidth', 'necklineDepth', 'necklineBend', 'lengthBonus', 'sleeveLength'],
advanced: brianConfig.optionGroups.advanced,
},
measurements: [...brianConfig.measurements, 'hips', 'waist'],
optionalMeasurements: ['highBust'],
dependencies: {
front: 'base',
back: 'front',
sleevecap: 'back',
sleeve: 'sleevecap',
},
inject: {
front: 'base',
back: 'front',
sleeve: 'sleevecap',
},
hide: ['base', 'sleevecap'],
options: {
...brianConfig.options,
// Constants
bicepsEase: 0.05,
shoulderEase: 0,
collarEase: 0,
shoulderSlopeReduction: 0,
sleeveWidthGuarantee: 0.85,
frontArmholeDeeper: 0.005,
// Brian overrides
chestEase: { pct: 12, min: 5, max: 25 },
sleeveLength: { pct: 30, min: 20, max: 100 },
lengthBonus: { pct: 5, min: -20, max: 60 },
backNeckCutout: { pct: 8, min: 4, max: 12 },
// Teagan specific
draftForHighBust: { bool: false },
hipsEase: { pct: 18, min: 8, max: 30 },
sleeveEase: { pct: 15, min: 5, max: 35 },
necklineDepth: { pct: 25, min: 20, max: 40 },
necklineWidth: { pct: 30, min: 10, max: 50 },
necklineBend: { pct: 30, min: 0, max: 70 },
},
}
export default config

View file

@ -1,5 +1,7 @@
export default function (part) {
let {
import { front } from './front.mjs'
function teaganBack(part) {
const {
store,
sa,
Point,
@ -88,3 +90,9 @@ export default function (part) {
return part
}
export const back = {
name: 'teagan.back',
from: front,
draft: teaganBack,
}

View file

@ -1,5 +1,7 @@
export default function (part) {
let {
import { base } from '@freesewing/brian'
function teaganFront(part) {
const {
utils,
store,
sa,
@ -160,3 +162,29 @@ export default function (part) {
return part
}
export const front = {
name: 'teagan.front',
from: base,
measurements: ['hips', 'waist'],
options: {
bicepsEase: 0.05,
shoulderEase: 0,
collarEase: 0,
shoulderSlopeReduction: 0,
sleeveWidthGuarantee: 0.85,
frontArmholeDeeper: 0.005,
// Brian overrides
chestEase: { pct: 12, min: 5, max: 25, menu: 'fit' },
sleeveLength: { pct: 30, min: 20, max: 100, menu: 'fit' },
lengthBonus: { pct: 5, min: -20, max: 60, menu: 'style' },
backNeckCutout: { pct: 8, min: 4, max: 12, menu: 'fit' },
// Teagan specific
draftForHighBust: { bool: false, menu: 'fit' },
hipsEase: { pct: 18, min: 8, max: 30, menu: 'fit' },
necklineDepth: { pct: 25, min: 20, max: 40, menu: 'style' },
necklineWidth: { pct: 30, min: 10, max: 50, menu: 'style' },
necklineBend: { pct: 30, min: 0, max: 70, menu: 'style' },
},
draft: teaganFront,
}

View file

@ -1,43 +1,14 @@
import freesewing from '@freesewing/core'
import Brian from '@freesewing/brian'
import plugins from '@freesewing/plugin-bundle'
import plugin from '@freesewing/plugin-bust' // Note: conditional plugin
import config from '../config'
// Parts
import draftBack from './back'
import draftFront from './front'
import draftSleeve from './sleeve'
import { Design } from '@freesewing/core'
import { data } from '../data.mjs'
import { back } from './back.mjs'
import { front } from './front.mjs'
import { sleeve } from './sleeve.mjs'
/* Check to see whether we should load the bust plugin
* Only of the `draftForHighBust` options is set
* AND the highBust measurement is available
*/
const condition = (settings = false) =>
settings &&
settings.options &&
settings.options.draftForHighBust &&
settings.measurements.highBust
? true
: false
// Create design
const Teagan = new freesewing.Design(config, plugins, { plugin, condition })
// Attach draft methods to prototype
Teagan.prototype.draftBase = function (part) {
// Getting the base part from Brian
return new Brian(this.settings).draftBase(part)
}
Teagan.prototype.draftSleevecap = function (part) {
// Getting the sleevecap part from Brian
return new Brian(this.settings).draftSleevecap(part)
}
Teagan.prototype.draftFront = (part) => draftFront(part)
Teagan.prototype.draftBack = (part) => draftBack(part)
Teagan.prototype.draftSleeve = (part) => draftSleeve(part)
// Setup our new design
const Teagan = new Design({
data,
parts: [back, front, sleeve],
})
// Named exports
export { config, Teagan }
// Default export
export default Teagan
export { back, front, sleeve, Teagan }

View file

@ -1,5 +1,7 @@
export default function (part) {
let { sa, Point, points, Path, paths, options, complete, paperless, macro, measurements } =
import { sleevecap } from '@freesewing/brian'
function teaganSleeve(part) {
const { sa, Point, points, Path, paths, options, complete, paperless, macro, measurements } =
part.shorthand()
let height = points.bicepsRight.x * options.sleeveLength
@ -81,3 +83,12 @@ export default function (part) {
return part
}
export const sleeve = {
name: 'teagan.sleeve',
from: sleevecap,
options: {
sleeveEase: { pct: 15, min: 5, max: 35, menu: 'style' },
},
draft: teaganSleeve,
}