diff --git a/designs/octoplushy/config.js b/designs/octoplushy/config.js index 3b75254a326..512ebdc7c23 100644 --- a/designs/octoplushy/config.js +++ b/designs/octoplushy/config.js @@ -8,9 +8,19 @@ export default { department: '', type: '', difficulty: 2, - tags: [ ], + tags: [], optionGroups: { - options: ['size','type','legWidth','legLength','neckWidth','legTaper','bottomTopLegRatio','bottomLegReduction'], + options: [ + 'size', + 'type', + 'legWidth', + 'legLength', + 'neckWidth', + 'legTaper', + 'bottomTopLegRatio', + 'bottomLegReduction', + 'bottomLegReductionPlushy', + ], }, measurements: [], dependencies: { @@ -18,21 +28,32 @@ export default { eye1: 'headSection0', eye2: 'headSection0', legSection0: 'headSection0', - legSection1: 'headSection1'}, + legSection1: 'headSection1', + }, inject: {}, hide: [], - parts: ['headSection0','headSection1','legSection0','legSection1','eye0','eye1','eye2'], + parts: ['headSection0', 'headSection1', 'legSection0', 'legSection1', 'eye0', 'eye1', 'eye2'], options: { sizeConstant: 200, size: { pct: 100, min: 5, max: 500 }, - type: { dflt: 'octoplushy', list: ['octoplushy','octopus','squid'] }, + type: { dflt: 'octoplushy', list: ['octoplushy', 'octopus', 'squid'] }, legWidth: { pct: 15, min: 10, max: 30 }, legLength: { pct: 200, min: 100, max: 500 }, neckWidth: { pct: 25, min: 25, max: 45 }, legTaper: { pct: 25, min: 0, max: 50 }, bottomTopLegRatio: { pct: 87, min: 75, max: 100 }, - bottomLegReduction: { pct: 80, min: 75, max: 125 }, - + bottomLegReduction: { + pct: 90, + min: 75, + max: 125, + hide: ({ options }) => options.type == 'octoplushy', + }, + bottomLegReductionPlushy: { + pct: 80, + min: 75, + max: 125, + hide: ({ options }) => options.type != 'octoplushy', + }, }, } diff --git a/designs/octoplushy/src/eye.js b/designs/octoplushy/src/eye.js index 15d815728bf..bcd01e1f3b6 100644 --- a/designs/octoplushy/src/eye.js +++ b/designs/octoplushy/src/eye.js @@ -26,15 +26,14 @@ export default function (partNumber, part) { let sectionWidth = store.get('sectionWidth') let eyeSize = sectionWidth / 1.5 - let logoScale = .25 - let titleScale = .25 + let logoScale = 0.25 + let titleScale = 0.25 if (partNumber == 1) { eyeSize *= 0.65 - logoScale = .15 - titleScale = .16 + logoScale = 0.15 + titleScale = 0.16 } - if (partNumber < 2) { points.top = new Point(0, -1 * (eyeSize / 2)) points.left = new Point(-1 * (eyeSize / 2), 0) @@ -59,20 +58,18 @@ export default function (partNumber, part) { .close() .attr('class', 'fabric') .setRender(true) - points.logo = points.top.shiftFractionTowards( - points.bottom, - 0.3 - ) + points.logo = points.top.shiftFractionTowards(points.bottom, 0.3) points.titleAnchor = points.bottom - .shiftFractionTowards(points.top, 0.25).shift(180,eyeSize/10) + .shiftFractionTowards(points.top, 0.25) + .shift(180, eyeSize / 10) } else { - logoScale = .35 - titleScale = .25 + logoScale = 0.35 + titleScale = 0.25 let eyeBrowWidth = eyeSize * 0.375 - let eyeCirc = (eyeSize +(eyeBrowWidth *2))* Math.PI + let eyeCirc = (eyeSize + eyeBrowWidth * 2) * Math.PI points.tl = new Point(0, 0) points.tr = points.tl.shift(0, eyeCirc) - points.bl = points.tl.shift(270, eyeBrowWidth *2) + points.bl = points.tl.shift(270, eyeBrowWidth * 2) points.br = points.bl.shift(0, eyeCirc) paths.eye = new Path() @@ -85,46 +82,49 @@ export default function (partNumber, part) { .attr('class', 'fabric') .setRender(true) - points.logo = points.tl.shiftFractionTowards( - points.bl, - 0.5 - ).shiftFractionTowards( - points.br, 0.3) - points.titleAnchor = points.tr.shiftFractionTowards( - points.br, - 0.5 - ).shiftFractionTowards( - points.bl, 0.3) + points.logo = points.tl + .shiftFractionTowards(points.bl, 0.5) + .shiftFractionTowards(points.br, 0.3) + points.titleAnchor = points.tr + .shiftFractionTowards(points.br, 0.5) + .shiftFractionTowards(points.bl, 0.3) } if (complete) { - snippets.logo = new Snippet('logo', points.logo).attr('data-scale', logoScale) macro('title', { at: points.titleAnchor, nr: 3 + partNumber * 3, - title: (partNumber == 2 ? 'eyebrow' : partNumber == 1 ? 'pupil' : 'eye' ), - scale: titleScale + title: partNumber == 2 ? 'eyebrow' : partNumber == 1 ? 'pupil' : 'eye', + scale: titleScale, }) if (sa) { - paths.sa = paths.eye.offset(Math.min(sa,6)).attr('class', 'fabric sa') + paths.sa = paths.eye.offset(Math.min(sa, 6)).attr('class', 'fabric sa') } } // Paperless? -// if (paperless) { -// macro('hd', { -// from: points.bottomLeft, -// to: points.bottomRight, -// y: points.bottomLeft.y + sa + 15, -// }) -// macro('vd', { -// from: points.bottomRight, -// to: points.topRight, -// x: points.topRight.x + sa + 15, -// }) -// } + if (paperless) { + if (partNumber < 2) { + macro('hd', { + from: points.left, + to: points.right, + y: points.top.y - sa, + }) + } else { + macro('hd', { + from: points.tl, + to: points.tr, + y: points.tl.y - sa, + }) + macro('vd', { + from: points.bl, + to: points.tl, + x: points.tl.x - sa, + }) + } + } return part } diff --git a/designs/octoplushy/src/headSection.js b/designs/octoplushy/src/headSection.js index d5336009eef..a21c47bd511 100644 --- a/designs/octoplushy/src/headSection.js +++ b/designs/octoplushy/src/headSection.js @@ -44,15 +44,14 @@ export default function (partNumber, part) { } let skirtWidth = (options.type == 'octopus' ? 2 : options.type == 'octoplushy' ? 0.7 : 1) * sectionWidth - // legWidth = skirtWidth > legWidth ? legWidth : skirtWidth skirtWidth = skirtWidth < legAdjustedWidth ? legAdjustedWidth : skirtWidth - console.log({ w: w }) - console.log({ sectionWidth: sectionWidth }) - console.log({ neckWidth: neckWidth }) - console.log({ legAdjustedWidth: w * options.legWidth * options.bottomTopLegRatio }) - console.log({ toplegWidth: legAdjustedWidth }) - console.log({ legLength: legLength }) + // console.log({ w: w }) + // console.log({ sectionWidth: sectionWidth }) + // console.log({ neckWidth: neckWidth }) + // console.log({ legAdjustedWidth: w * options.legWidth * options.bottomTopLegRatio }) + // console.log({ toplegWidth: legAdjustedWidth }) + // console.log({ legLength: legLength }) points.topLeft = new Point(-1 * w, -1 * h) points.topRight = new Point(w, -1 * h) @@ -61,14 +60,8 @@ export default function (partNumber, part) { points.left = new Point(-1 * w, 0) points.right = new Point(w, 0) - // points.sectionTop = points.topLeft.shiftFractionTowards(points.topRight, 1 / sections / 2) points.sectionTop = new Point(0, -1 * h) - // points.sectionBottom = points.bottomLeft.shiftFractionTowards( - // points.bottomRight, - // 1 / sections / 2 - // ) points.sectionBottom = new Point(0, h) - // let sectionMid = points.left.shiftFractionTowards(points.sectionTop, 0.5) points.sectionLeft = new Point((-1 * sectionWidth) / 2, 0) let sectionMid = points.sectionLeft.shiftFractionTowards(points.sectionTop, 0.5) @@ -160,24 +153,7 @@ export default function (partNumber, part) { (points.skirtTopMiddle.y - points.skirtBottomLeft3.y) / 2 ) } - // points.skirtBottomLeft = points.skirtTopMiddle.shift(270 - 360 / sections / 2, skirtWidth / 2 / Math.sin(utils.deg2rad(360 / sections / 2))) points.skirtBottomLeft = points.skirtBottomLeft3.clone() - // paths.leftTemp = new Path().move(points.skirtBottomLeft).line(points.skirtBottomLeftTempCp2 ) - - // if (options.type == 'octopus') { - // skirtWidth = 3 - // points.skirtBottomLeft = utils.beamIntersectsX( - // points.sectionBottomLeft, - // points.sectionBottomLeft.shift(180 + 45, 100), - // points.sectionLeft.x - neckWidth * 1.5 - // ) - // } else { - // points.skirtBottomLeft = utils.beamIntersectsX( - // points.sectionBottomLeft, - // points.sectionBottomLeft.shift(180 + 45, 100), - // points.sectionLeft.x - // ) - // } points.legTopLeft = utils.beamIntersectsX( points.skirtBottomLeft, points.skirtBottomLeft.shift(270 + 30, 100), @@ -414,15 +390,15 @@ export default function (partNumber, part) { .close() .attr('class', 'fabric') - paths.seam = new Path() - .move(points.topLeft) - .line(points.bottomLeft) - .line(points.bottomRight) - .line(points.topRight) - .line(points.topLeft) - .close() - .attr('class', 'fabric') - .setRender(false) + // paths.box = new Path() + // .move(points.topLeft) + // .line(points.bottomLeft) + // .line(points.bottomRight) + // .line(points.topRight) + // .line(points.topLeft) + // .close() + // .attr('class', 'fabric') + // .setRender(false) // Complete? if (complete) { @@ -529,16 +505,108 @@ export default function (partNumber, part) { // Paperless? if (paperless) { macro('hd', { - from: points.bottomLeft, - to: points.bottomRight, - y: points.bottomLeft.y + sa + 15, + from: points.sectionLeft, + to: points.sectionRight, + y: points.sectionTop.y - sa, + }) + macro('hd', { + from: points.legTopLeft, + to: points.legTopRight, + y: points.legTopRight.y, + }) + macro('hd', { + from: points.legBottomLeft, + to: points.legBottomRight, + y: points.legBottom.y + sa + 10, + }) + + macro('vd', { + from: points.sectionTop, + to: points.sectionRight, + x: points.skirtBottomRight.x + sa + 10, }) macro('vd', { - from: points.bottomRight, - to: points.topRight, - x: points.topRight.x + sa + 15, + from: points.sectionTop, + to: points.sectionBottomRight, + x: points.skirtBottomRight.x + sa + 20, + }) + macro('vd', { + from: points.sectionTop, + to: points.skirtBottomRight, + x: points.skirtBottomRight.x + sa + 30, + }) + macro('vd', { + from: points.sectionTop, + to: points.legBottom, + x: points.skirtBottomRight.x + sa + 40, }) - } + if (options.type == 'octopus') { + macro('hd', { + from: points.skirtBottomLeft, + to: points.skirtBottomRight, + y: points.skirtBottomRight.y, + }) + macro('vd', { + from: points.skirtBottomRight, + to: points.legTopRight, + x: points.skirtBottomRight.x + sa + 30, + }) + } + if (options.type == 'squid') { + macro('vd', { + from: points.legTopLeft, + to: points.sectionBottomLeft, + x: points.legTopLeft.x - sa - 10, + }) + macro('vd', { + from: points.sectionBottomLeft, + to: points.sectionMidLeft, + x: points.legTopLeft.x - sa - 10, + }) + if (partNumber == 1) { + macro('hd', { + from: points.tentacleLeft, + to: points.tentacleRight, + y: points.tentacleRight.y, + }) + macro('hd', { + from: points.finSeam, + to: points.sectionTop, + y: points.sectionTop.y, + }) + macro('hd', { + from: points.finSeam, + to: points.finSection, + y: points.finSection.y, + }) + macro('hd', { + from: points.finFold, + to: points.finSection, + y: points.finFold.y, + }) + macro('vd', { + from: points.legBottom, + to: points.tentacleLeft, + x: points.tentacleLeft.x - sa - 10, + }) + macro('vd', { + from: points.finSeam, + to: points.sectionTop, + x: points.finSeam.x - sa, + }) + macro('vd', { + from: points.finFold, + to: points.sectionTop, + x: points.finSeam.x - sa - 10, + }) + macro('vd', { + from: points.finSection, + to: points.sectionTop, + x: points.finSeam.x - sa - 20, + }) + } + } + } return part } diff --git a/designs/octoplushy/src/index.js b/designs/octoplushy/src/index.js index 7fcfda36df8..769658f2e06 100644 --- a/designs/octoplushy/src/index.js +++ b/designs/octoplushy/src/index.js @@ -10,15 +10,14 @@ const Pattern = new freesewing.Design(config, plugins) // Attach the draft methods to the prototype // Pattern.prototype.draftHeadSection = draftHeadSection -for( let i = 0; i < 2; i ++ ){ +for (let i = 0; i < 2; i++) { Pattern.prototype[`draftHeadSection${i}`] = (part) => draftHeadSection(i, part) } -for( let i = 0; i < 2; i ++ ){ +for (let i = 0; i < 2; i++) { Pattern.prototype[`draftLegSection${i}`] = (part) => draftLegSection(i, part) } -for( let i = 0; i < 3; i ++ ){ +for (let i = 0; i < 3; i++) { Pattern.prototype[`draftEye${i}`] = (part) => draftEye(i, part) } - export default Pattern diff --git a/designs/octoplushy/src/legSection.js b/designs/octoplushy/src/legSection.js index 32e90513ed8..1f46a1fa51a 100644 --- a/designs/octoplushy/src/legSection.js +++ b/designs/octoplushy/src/legSection.js @@ -1,6 +1,3 @@ -// import mirror from '@freesewing/plugin-mirror' -// import { Store } from '@material-ui/icons' - export default function (partNumber, part) { console.log({ part: part }) const { @@ -45,7 +42,7 @@ export default function (partNumber, part) { } break case 'octoplushy': - legLength *= options.bottomLegReduction + legLength *= options.bottomLegReductionPlushy } points.legMiddle = new Point(0, 0) @@ -257,39 +254,61 @@ export default function (partNumber, part) { } if (paperless) { - // macro('hd', { - // from: points.topFin01, - // to: points.topFinRight, - // y: points.topFin01.y - sa - 10, - // }) - // macro('hd', { - // from: points.topFin03, - // to: points.topFinRight, - // y: points.topFin03.y + sa + 20, - // }) - // macro('hd', { - // from: points.topFinLeft, - // to: points.topFinRight, - // y: points.topFin03.y + sa + 10, - // }) - macro('vd', { - from: points.legMiddle, - to: points.legBottom, - x: points.legTopLeft.x - sa - 10, + macro('hd', { + from: points.legTopLeft, + to: points.legTopRight, + y: points.legMiddle.y - sa, + }) + macro('hd', { + from: points.legBottomLeft, + to: points.legBottomRight, + y: points.legBottom.y + sa + 10, }) - console.log( {legLength: points.legMiddle.dist( points.legBottom ) }) - // macro('vd', { - // from: points.topFin01, - // to: points.topFinInsideBottom, - // x: points.topFin02.x +sa + 10, - // }) - // macro('vd', { - // from: points.topFinInsideTop, - // to: points.topFin01, - // x: points.topFinLeft.x -sa - 20, - // }) - } + macro('vd', { + from: points.legBottom, + to: points.legMiddle, + x: points.skirtLeft.x - sa - 20, + }) + + if (options.type == 'octopus') { + macro('hd', { + from: points.skirtLeft, + to: points.skirtRight, + y: points.skirtRight.y, + }) + macro('vd', { + from: points.skirtLeft, + to: points.legMiddle, + x: points.skirtLeft.x - sa - 10, + }) + macro('vd', { + from: points.legTopLeft, + to: points.skirtLeft, + x: points.skirtLeft.x - sa - 10, + }) + } else { + macro('vd', { + from: points.legTopLeft, + to: points.legMiddle, + x: points.skirtLeft.x - sa - 10, + }) + } + if (options.type == 'squid') { + if (partNumber == 1) { + macro('hd', { + from: points.tentacleLeft, + to: points.tentacleRight, + y: points.tentacleRight.y, + }) + macro('vd', { + from: points.legBottom, + to: points.tentacleLeft, + x: points.tentacleLeft.x - sa - 10, + }) + } + } + } } return part