1
0
Fork 0

Merge pull request #2725 from BenJamesBen/v3-port-benjamin-2

Port Benjamin to v3.
This commit is contained in:
Joost De Cock 2022-09-04 11:25:35 +02:00 committed by GitHub
commit 24beaaf97f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 95 deletions

View file

@ -1,69 +0,0 @@
import pkg from '../package.json' assert { type: 'json' }
const { version } = pkg
export default {
version,
name: 'benjamin',
design: 'Wouter Van Wageningen',
code: 'Wouter Van Wageningen',
department: 'accessories',
type: 'pattern',
difficulty: 3,
optionGroups: {
fit: ['collarEase', 'adjustmentRibbon'],
style: ['tipWidth', 'knotWidth', 'bowLength', 'bowStyle', 'endStyle', 'ribbonWidth'],
},
measurements: ['neck'],
dependencies: {
ribbon: 'base',
},
inject: {
bow1: 'base',
bow2: 'base',
bow3: 'base',
},
hide: ['base'],
parts: ['ribbon'],
options: {
transitionLength: 2, //Twice the knot
bandLength: 0.17,
ribbonWidth: {
pct: 6,
min: 5,
max: 8,
},
tipWidth: {
pct: 15,
min: 0,
max: 20,
},
knotWidth: {
pct: 7,
min: 5,
max: 10,
},
bowLength: {
pct: 28,
min: 23,
max: 33,
},
collarEase: {
pct: 3,
min: 0,
max: 6,
},
bowStyle: {
dflt: 'butterfly',
list: ['diamond', 'butterfly', 'square', 'widesquare'],
},
endStyle: {
dflt: 'straight',
list: ['straight', 'pointed', 'rounded'],
},
adjustmentRibbon: {
bool: false,
},
adjustmentRibbonWidth: 20,
},
}

View file

@ -1,4 +1,6 @@
export default function (part) {
import { pluginBundle } from '@freesewing/plugin-bundle'
function draftBenjaminBase (part) {
let {
store,
sa,
@ -200,3 +202,36 @@ export default function (part) {
return part
}
export const base = {
name: 'benjamin.base',
hide: true,
measurements: [
'neck',
],
options: {
// Static options
transitionLength: 2, //Twice the knot
bandLength: 0.17,
adjustmentRibbonWidth: 20,
// Fit options
collarEase: { pct: 3, min: 0, max: 6, menu: 'fit' },
adjustmentRibbon: { bool: false, menu: 'fit' },
// Style options
tipWidth: { pct: 15, min: 0, max: 20, menu: 'style' },
knotWidth: { pct: 7, min: 5, max: 10, menu: 'style' },
bowLength: { pct: 28, min: 23, max: 33, menu: 'style' },
bowStyle: { dflt: 'butterfly',
list: ['diamond', 'butterfly', 'square', 'widesquare'],
menu: 'style'
},
endStyle: {
dflt: 'straight',
list: ['straight', 'pointed', 'rounded'],
menu: 'style'
},
ribbonWidth: { pct: 6, min: 5, max: 8, menu: 'style' },
},
plugins: [ pluginBundle ],
draft: draftBenjaminBase,
}

View file

@ -1,4 +1,6 @@
export default function (part) {
import { base } from './base.mjs'
function draftBenjaminBow1 (part) {
let { Point, points, Path, paths, complete, macro, sa, store, paperless } = part.shorthand()
points.bandBottomLeft = points.bandBottomLeft.shift(0, 0)
@ -44,3 +46,9 @@ export default function (part) {
return part
}
export const bow1 = {
name: 'benjamin.bow1',
from: base,
draft: draftBenjaminBow1,
}

View file

@ -1,4 +1,6 @@
export default function (part) {
import { base } from './base.mjs'
function draftBenjaminBow2 (part) {
let { options, Point, points, Path, paths, complete, macro, sa, store, paperless } =
part.shorthand()
@ -48,3 +50,9 @@ export default function (part) {
return part
}
export const bow2 = {
name: 'benjamin.bow2',
from: base,
draft: draftBenjaminBow2,
}

View file

@ -1,4 +1,6 @@
export default function (part) {
import { base } from './base.mjs'
function draftBenjaminBow3 (part) {
let { options, Point, points, Path, paths, complete, macro, sa, store, paperless } =
part.shorthand()
@ -48,3 +50,9 @@ export default function (part) {
return part
}
export const bow3 = {
name: 'benjamin.bow3',
from: base,
draft: draftBenjaminBow3,
}

View file

@ -1,25 +1,16 @@
import freesewing from '@freesewing/core'
import plugins from '@freesewing/plugin-bundle'
import config from '../config'
// Parts
import draftBase from './base'
import draftBow1 from './bow1'
import draftBow2 from './bow2'
import draftBow3 from './bow3'
import draftRibbon from './ribbon'
import { Design } from '@freesewing/core'
import { data } from '../data.mjs'
import { bow1 } from './bow1.mjs'
import { bow2 } from './bow2.mjs'
import { bow3 } from './bow3.mjs'
import { ribbon } from './ribbon.mjs'
// Create new design
const Benjamin = new freesewing.Design(config, plugins)
// Attach draft methods to prototype
Benjamin.prototype.draftBase = draftBase
Benjamin.prototype.draftBow1 = draftBow1
Benjamin.prototype.draftBow2 = draftBow2
Benjamin.prototype.draftBow3 = draftBow3
Benjamin.prototype.draftRibbon = draftRibbon
// Setup our new design
const Benjamin = new Design({
data,
parts: [ bow1, bow2, bow3, ribbon ],
})
// Named exports
export { config, Benjamin }
export { bow1, bow2, bow3, ribbon, Benjamin }
// Default export
export default Benjamin

View file

@ -1,4 +1,4 @@
export default function (part) {
function draftBenjaminRibbon (part) {
let { Point, Path, measurements, store, options, complete, macro, points, paths, sa, paperless } =
part.shorthand()
@ -52,3 +52,8 @@ export default function (part) {
return part
}
export const ribbon = {
name: 'benjamin.ribbon',
draft: draftBenjaminRibbon,
}