chore(octopussy): Ported to v3
This commit is contained in:
parent
bc9332f2e0
commit
e82cebe445
5 changed files with 79 additions and 80 deletions
|
@ -1,49 +0,0 @@
|
||||||
import pkg from '../package.json' assert { type: 'json' }
|
|
||||||
|
|
||||||
const { version } = pkg
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'octoplushy',
|
|
||||||
version: version,
|
|
||||||
design: 'Wouter Van Wageningen',
|
|
||||||
code: 'Wouter Van Wageningen',
|
|
||||||
department: 'accessories',
|
|
||||||
type: 'pattern',
|
|
||||||
difficulty: 5,
|
|
||||||
optionGroups: {
|
|
||||||
style: ['size','type','armWidth','armLength','neckWidth','armTaper','bottomTopArmRatio','bottomArmReduction','bottomArmReductionPlushy'],
|
|
||||||
},
|
|
||||||
parts: ['headSection0', 'headSection1', 'armSection0', 'armSection1', 'eye0', 'eye1', 'eye2'],
|
|
||||||
measurements: [],
|
|
||||||
dependencies: {
|
|
||||||
eye0: 'headSection0',
|
|
||||||
eye1: 'headSection0',
|
|
||||||
eye2: 'headSection0',
|
|
||||||
armSection0: 'headSection0',
|
|
||||||
armSection1: 'headSection1',
|
|
||||||
},
|
|
||||||
inject: {},
|
|
||||||
hide: [],
|
|
||||||
options: {
|
|
||||||
sizeConstant: 200,
|
|
||||||
size: { pct: 100, min: 5, max: 500 },
|
|
||||||
type: { dflt: 'octoplushy', list: ['octoplushy', 'octopus', 'squid'] },
|
|
||||||
armWidth: { pct: 15, min: 10, max: 30 },
|
|
||||||
armLength: { pct: 200, min: 100, max: 500 },
|
|
||||||
neckWidth: { pct: 25, min: 25, max: 45 },
|
|
||||||
armTaper: { pct: 25, min: 0, max: 50 },
|
|
||||||
bottomTopArmRatio: { pct: 87, min: 75, max: 100 },
|
|
||||||
bottomArmReduction: {
|
|
||||||
pct: 90,
|
|
||||||
min: 75,
|
|
||||||
max: 125,
|
|
||||||
hide: ({ options }) => options.type == 'octoplushy',
|
|
||||||
},
|
|
||||||
bottomArmReductionPlushy: {
|
|
||||||
pct: 80,
|
|
||||||
min: 75,
|
|
||||||
max: 125,
|
|
||||||
hide: ({ options }) => options.type != 'octoplushy',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default function (partNumber, part) {
|
import { headSection1, headSection2 } from './head.mjs'
|
||||||
|
|
||||||
|
function octoplushyArmSection(partNumber, part) {
|
||||||
const {
|
const {
|
||||||
options,
|
options,
|
||||||
Point,
|
Point,
|
||||||
|
@ -309,3 +311,14 @@ export default function (partNumber, part) {
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const armSection1 = {
|
||||||
|
name: 'octoplushy.armSection1',
|
||||||
|
after: headSection1,
|
||||||
|
draft: (part) => octoplushyArmSection(0, part),
|
||||||
|
}
|
||||||
|
export const armSection2 = {
|
||||||
|
name: 'octoplushy.armSection2',
|
||||||
|
after: headSection2,
|
||||||
|
draft: (part) => octoplushyArmSection(1, part),
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
export default function (partNumber, part) {
|
import { headSection1 } from './head.mjs'
|
||||||
|
|
||||||
|
function octoplushyEye(partNumber, part) {
|
||||||
const {
|
const {
|
||||||
options,
|
options,
|
||||||
Point,
|
Point,
|
||||||
|
@ -127,3 +129,19 @@ export default function (partNumber, part) {
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const eye1 = {
|
||||||
|
name: 'octoplushy.eye1',
|
||||||
|
after: headSection1,
|
||||||
|
draft: (part) => octoplushyEye(0, part),
|
||||||
|
}
|
||||||
|
export const eye2 = {
|
||||||
|
name: 'octoplushy.eye2',
|
||||||
|
after: headSection1,
|
||||||
|
draft: (part) => octoplushyEye(1, part),
|
||||||
|
}
|
||||||
|
export const eye3 = {
|
||||||
|
name: 'octoplushy.eye3',
|
||||||
|
after: headSection1,
|
||||||
|
draft: (part) => octoplushyEye(2, part),
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
// import mirror from '@freesewing/plugin-mirror'
|
function octoplushyHeadSection(partNumber, part) {
|
||||||
// import { PostAddSharp } from '@material-ui/icons'
|
|
||||||
// import { Store } from "@material-ui/icons";
|
|
||||||
|
|
||||||
export default function (partNumber, part) {
|
|
||||||
const {
|
const {
|
||||||
options,
|
options,
|
||||||
Point,
|
Point,
|
||||||
|
@ -607,3 +603,37 @@ export default function (partNumber, part) {
|
||||||
}
|
}
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
sizeConstant: 200,
|
||||||
|
size: { pct: 100, min: 5, max: 500, menu: 'style' },
|
||||||
|
type: { dflt: 'octoplushy', list: ['octoplushy', 'octopus', 'squid'], menu: 'style' },
|
||||||
|
armWidth: { pct: 15, min: 10, max: 30, menu: 'style' },
|
||||||
|
armLength: { pct: 200, min: 100, max: 500, menu: 'style' },
|
||||||
|
neckWidth: { pct: 25, min: 25, max: 45, menu: 'style' },
|
||||||
|
armTaper: { pct: 25, min: 0, max: 50, menu: 'style' },
|
||||||
|
bottomTopArmRatio: { pct: 87, min: 75, max: 100, menu: 'style' },
|
||||||
|
bottomArmReduction: {
|
||||||
|
pct: 90,
|
||||||
|
min: 75,
|
||||||
|
max: 125,
|
||||||
|
menu: ({ options }) => (options.type == 'octoplushy' ? 'style' : false),
|
||||||
|
},
|
||||||
|
bottomArmReductionPlushy: {
|
||||||
|
pct: 80,
|
||||||
|
min: 75,
|
||||||
|
max: 125,
|
||||||
|
menu: ({ options }) => (options.type != 'octoplushy' ? 'style' : false),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const headSection1 = {
|
||||||
|
name: 'octoplushy.headSection1',
|
||||||
|
options,
|
||||||
|
draft: (part) => octoplushyHeadSection(0, part),
|
||||||
|
}
|
||||||
|
export const headSection2 = {
|
||||||
|
name: 'octoplushy.headSection2',
|
||||||
|
options,
|
||||||
|
draft: (part) => octoplushyHeadSection(1, part),
|
||||||
|
}
|
|
@ -1,27 +1,14 @@
|
||||||
import freesewing from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import plugins from '@freesewing/plugin-bundle'
|
import { data } from '../data.mjs'
|
||||||
import config from '../config'
|
import { headSection1, headSection2 } from './head.mjs'
|
||||||
import draftHeadSection from './headSection'
|
import { armSection1, armSection2 } from './arm.mjs'
|
||||||
import draftArmSection from './armSection'
|
import { eye1, eye2, eye3 } from './eye.mjs'
|
||||||
import draftEye from './eye'
|
|
||||||
|
|
||||||
// Create new design
|
// Setup our new design
|
||||||
const Octoplushy = new freesewing.Design(config, plugins)
|
const Octoplushy = new Design({
|
||||||
|
data,
|
||||||
// Attach the draft methods to the prototype
|
parts: [headSection1, headSection2, armSection1, armSection2, eye1, eye2, eye3],
|
||||||
// Octoplushy.prototype.draftHeadSection = draftHeadSection
|
})
|
||||||
for (let i = 0; i < 2; i++) {
|
|
||||||
Octoplushy.prototype[`draftHeadSection${i}`] = (part) => draftHeadSection(i, part)
|
|
||||||
}
|
|
||||||
for (let i = 0; i < 2; i++) {
|
|
||||||
Octoplushy.prototype[`draftArmSection${i}`] = (part) => draftArmSection(i, part)
|
|
||||||
}
|
|
||||||
for (let i = 0; i < 3; i++) {
|
|
||||||
Octoplushy.prototype[`draftEye${i}`] = (part) => draftEye(i, part)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Named exports
|
// Named exports
|
||||||
export { config, Octoplushy }
|
export { headSection1, headSection2, armSection1, armSection2, eye1, eye2, eye3, Octoplushy }
|
||||||
|
|
||||||
// Default export
|
|
||||||
export default Octoplushy
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue