1
0
Fork 0

Port Cathrin to v3.

This commit is contained in:
Benjamin F 2022-09-04 17:29:32 -07:00
parent 4f0e45cc75
commit 713c8092ba
11 changed files with 118 additions and 89 deletions

View file

@ -1,53 +0,0 @@
import pkg from '../package.json' assert { type: 'json' }
const { version } = pkg
export default {
version,
name: 'cathrin',
design: ['Cathrin Åhlén', 'Joost De Cock'],
code: 'Joost De Cock',
department: 'underwear',
type: 'pattern',
difficulty: 4,
optionGroups: {
fit: ['waistReduction', 'panels'],
style: ['backOpening', 'backRise', 'backDrop', 'frontRise', 'frontDrop', 'hipRise'],
},
measurements: ['underbust', 'waist', 'hips', 'waistToUnderbust', 'waistToHips'],
dependencies: {
panel1: 'panels',
panel2: 'panels',
panel3: 'panels',
panel4: 'panels',
panel5: 'panels',
panel6: 'panels',
panels: 'base',
},
inject: {
panel1: 'panels',
panel2: 'panels',
panel3: 'panels',
panel4: 'panels',
panel5: 'panels',
panel6: 'panels',
panels: 'base',
},
hide: ['panels', 'base'],
options: {
// Lists
panels: {
list: ['11', '13'],
dflt: '13',
},
// Percentages
waistReduction: { pct: 10, min: 2, max: 20 },
backOpening: { pct: 4, min: 3, max: 10 },
backRise: { pct: 15, min: 1, max: 25 },
backDrop: { pct: 2, min: 0, max: 5 },
frontRise: { pct: 4, min: 0.1, max: 8 },
frontDrop: { pct: 5, min: 0, max: 10 },
hipRise: { pct: 5, min: 0, max: 15 },
},
}

View file

@ -1,4 +1,4 @@
export default function (part) {
function draftCathrinBase (part) {
let { measurements, options, store, points, paths, Point, Path } = part.shorthand()
// Where to divide our corset into panels
@ -90,3 +90,22 @@ export default function (part) {
return part
}
export const base = {
name: 'cathrin.base',
hide: true,
measurements: [
'underbust', 'waist', 'hips', 'waistToUnderbust', 'waistToHips',
],
options: {
waistReduction: { pct: 10, min: 2, max: 20, menu: 'fit' },
panels: { list: ['11', '13'], dflt: '13', menu: 'fit' },
backOpening: { pct: 4, min: 3, max: 10, menu: 'style' },
backRise: { pct: 15, min: 1, max: 25, menu: 'style' },
backDrop: { pct: 2, min: 0, max: 5, menu: 'style' },
frontRise: { pct: 4, min: 0.1, max: 8, menu: 'style' },
frontDrop: { pct: 5, min: 0, max: 10, menu: 'style' },
hipRise: { pct: 5, min: 0, max: 15, menu: 'style' },
},
draft: draftCathrinBase,
}

View file

@ -1,31 +1,26 @@
import freesewing from '@freesewing/core'
import plugins from '@freesewing/plugin-bundle'
import config from '../config'
import { Design } from '@freesewing/core'
import { data } from '../data.mjs'
//Parts
import draftBase from './base'
import draftPanels from './panels'
import draftPanel1 from './panel1'
import draftPanel2 from './panel2'
import draftPanel3 from './panel3'
import draftPanel4 from './panel4'
import draftPanel5 from './panel5'
import draftPanel6 from './panel6'
import { panel1 } from './panel1.mjs'
import { panel2 } from './panel2.mjs'
import { panel3 } from './panel3.mjs'
import { panel4 } from './panel4.mjs'
import { panel5 } from './panel5.mjs'
import { panel6 } from './panel6.mjs'
// Skeleton parts for export
import { base } from './base.mjs'
import { panels } from './panels.mjs'
// Create design
const Cathrin = new freesewing.Design(config, plugins)
// Attach draft methods to prototype
Cathrin.prototype.draftBase = draftBase
Cathrin.prototype.draftPanels = draftPanels
Cathrin.prototype.draftPanel1 = draftPanel1
Cathrin.prototype.draftPanel2 = draftPanel2
Cathrin.prototype.draftPanel3 = draftPanel3
Cathrin.prototype.draftPanel4 = draftPanel4
Cathrin.prototype.draftPanel5 = draftPanel5
Cathrin.prototype.draftPanel6 = draftPanel6
const Cathrin = new Design({
data,
parts: [
panel1, panel2, panel3, panel4, panel5, panel6,
],
})
// Named exports
export { config, Cathrin }
// Default export
export default Cathrin
export {
base, panels, panel1, panel2, panel3, panel4, panel5, panel6,
Cathrin,
}

View file

@ -1,6 +1,8 @@
import draftPanel1ab from './panel1ab'
import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs'
import { draftPanel1ab } from './panel1ab.mjs'
export default function (part) {
function draftCathrinPanel1 (part) {
let { macro, sa, paths, points, options, complete, paperless } = part.shorthand()
points.anchor = points.topCF.clone()
@ -70,3 +72,10 @@ export default function (part) {
return part
}
export const panel1 = {
name: 'cathrin.panel1',
from: panels,
plugins: [ pluginBundle ],
draft: draftCathrinPanel1,
}

View file

@ -1,4 +1,4 @@
export default function (part) {
export function draftPanel1ab (part) {
let { macro, utils, sa, points, paths, Point, Path, complete, paperless } = part.shorthand()
points.anchor = points.topCF.clone()

View file

@ -1,4 +1,7 @@
export default function (part) {
import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs'
function draftCathrinPanel2 (part) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap1Right.clone()
@ -70,3 +73,10 @@ export default function (part) {
return part
}
export const panel2 = {
name: 'cathrin.panel2',
from: panels,
plugins: [ pluginBundle ],
draft: draftCathrinPanel2,
}

View file

@ -1,4 +1,7 @@
export default function (part) {
import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs'
function draftCathrinPanel3 (part) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap2Right.clone()
@ -70,3 +73,10 @@ export default function (part) {
return part
}
export const panel3 = {
name: 'cathrin.panel3',
from: panels,
plugins: [ pluginBundle ],
draft: draftCathrinPanel3,
}

View file

@ -1,4 +1,7 @@
export default function (part) {
import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs'
function draftCathrinPanel4 (part) {
let { macro, sa, snippets, Snippet, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap3Right.clone()
@ -73,3 +76,10 @@ export default function (part) {
return part
}
export const panel4 = {
name: 'cathrin.panel4',
from: panels,
plugins: [ pluginBundle ],
draft: draftCathrinPanel4,
}

View file

@ -1,4 +1,7 @@
export default function (part) {
import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs'
function draftCathrinPanel5 (part) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap4Right.clone()
@ -70,3 +73,10 @@ export default function (part) {
return part
}
export const panel5 = {
name: 'cathrin.panel5',
from: panels,
plugins: [ pluginBundle ],
draft: draftCathrinPanel5,
}

View file

@ -1,4 +1,7 @@
export default function (part) {
import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs'
function draftCathrinPanel6 (part) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.backRise.clone()
@ -75,3 +78,10 @@ export default function (part) {
return part
}
export const panel6 = {
name: 'cathrin.panel6',
from: panels,
plugins: [ pluginBundle ],
draft: draftCathrinPanel6,
}

View file

@ -1,4 +1,6 @@
export default function (part) {
import { base } from './base.mjs'
function draftCathrinPanels (part) {
let { measurements, options, store, points, paths, Point, Path } = part.shorthand()
let count = 1
let bottom = new Path()
@ -139,3 +141,10 @@ export default function (part) {
return part
}
export const panels = {
name: 'cathrin.panels',
from: base,
hide: true,
draft: draftCathrinPanels,
}