diff --git a/config/software/designs.json b/config/software/designs.json index 4c7fb00fdac..0e55052822c 100644 --- a/config/software/designs.json +++ b/config/software/designs.json @@ -184,7 +184,7 @@ "design": "Wouter Van Wageningen", "difficulty": 4, "tags": ["accessories", "toys"], - "techniques": [] + "techniques": ["curvedSeam", "dart"] }, "holmes": { "description": "A FreeSewing pattern for a Sherlock Holmes hat", @@ -270,7 +270,7 @@ "design": "Wouter Van Wageningen", "difficulty": 3, "tags": ["blocks", "tops"], - "techniques": [] + "techniques": ["curvedSeam", "precision", "princessSeam"] }, "octoplushy": { "description": "A FreeSewing pattern for an octopus plushy toy", @@ -278,7 +278,7 @@ "design": "Wouter Van Wageningen", "difficulty": 4, "tags": ["accessories", "toys"], - "techniques": [] + "techniques": ["curvedSeam", "precision"] }, "paco": { "description": "A FreeSewing pattern for summer pants", @@ -294,7 +294,7 @@ "design": "Wouter Van Wageningen", "difficulty": 3, "tags": ["bottoms", "skirts"], - "techniques": [] + "techniques": ["hem", "curvedSeam", "precision", "zipper"] }, "plugintest": { "description": "A FreeSewing pattern to test (y)our plugins", diff --git a/designs/aaron/package.json b/designs/aaron/package.json index ebd7319b1b7..85c4305deae 100644 --- a/designs/aaron/package.json +++ b/designs/aaron/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/albert/package.json b/designs/albert/package.json index 445794b967e..91ef2a9d335 100644 --- a/designs/albert/package.json +++ b/designs/albert/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/bee/package.json b/designs/bee/package.json index e08dd2668e4..f43498c39c5 100644 --- a/designs/bee/package.json +++ b/designs/bee/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/bella/package.json b/designs/bella/package.json index 86ef956701a..545218c8c0f 100644 --- a/designs/bella/package.json +++ b/designs/bella/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/benjamin/package.json b/designs/benjamin/package.json index 747456d2b7e..93343977a7f 100644 --- a/designs/benjamin/package.json +++ b/designs/benjamin/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/bent/package.json b/designs/bent/package.json index 241de500a2f..b058939170f 100644 --- a/designs/bent/package.json +++ b/designs/bent/package.json @@ -57,7 +57,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/bob/package.json b/designs/bob/package.json index f582e768dc3..2bab8bde7d8 100644 --- a/designs/bob/package.json +++ b/designs/bob/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/breanna/package.json b/designs/breanna/package.json index 6d30c22838f..74ee1ac7265 100644 --- a/designs/breanna/package.json +++ b/designs/breanna/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/brian/package.json b/designs/brian/package.json index c0a3b286847..b00edf1b367 100644 --- a/designs/brian/package.json +++ b/designs/brian/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/bruce/package.json b/designs/bruce/package.json index f77e2565f70..a2f292df04d 100644 --- a/designs/bruce/package.json +++ b/designs/bruce/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/carlita/package.json b/designs/carlita/package.json index 389dab3c792..de85bbcf682 100644 --- a/designs/carlita/package.json +++ b/designs/carlita/package.json @@ -59,7 +59,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/carlton/package.json b/designs/carlton/package.json index 81faef4a51e..aa5e4c6ba04 100644 --- a/designs/carlton/package.json +++ b/designs/carlton/package.json @@ -58,7 +58,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/cathrin/package.json b/designs/cathrin/package.json index 77c57f1d4ff..23b89949652 100644 --- a/designs/cathrin/package.json +++ b/designs/cathrin/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/charlie/package.json b/designs/charlie/package.json index 3176bdb8bbb..733521f5ce0 100644 --- a/designs/charlie/package.json +++ b/designs/charlie/package.json @@ -58,7 +58,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/cornelius/package.json b/designs/cornelius/package.json index a49d297c135..929be3c9170 100644 --- a/designs/cornelius/package.json +++ b/designs/cornelius/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/diana/package.json b/designs/diana/package.json index c52d7024dff..903195bd2ac 100644 --- a/designs/diana/package.json +++ b/designs/diana/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/examples/package.json b/designs/examples/package.json index 25d3709c2e0..ce7dfe66c46 100644 --- a/designs/examples/package.json +++ b/designs/examples/package.json @@ -51,7 +51,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/florence/package.json b/designs/florence/package.json index be776f2f98d..93115515827 100644 --- a/designs/florence/package.json +++ b/designs/florence/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/florent/package.json b/designs/florent/package.json index add79d9beae..3c046d0cc35 100644 --- a/designs/florent/package.json +++ b/designs/florent/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/hi/i18n/en.json b/designs/hi/i18n/en.json index fe70d574b9c..40271391e29 100644 --- a/designs/hi/i18n/en.json +++ b/designs/hi/i18n/en.json @@ -2,21 +2,21 @@ "t": "Hi the shark", "d": "The world's friendliest shark", "p": { - "aboveMouth": "Above mouth", + "aboveMouth": "Above mouth piece", "belly": "Belly", "body": "Body", - "bottomFin": "Bottom fin", - "lowerTeeth": "Lower teetch", + "bottomOfFin": "Bottom of fin", + "lowerTeeth": "Lower teeth", "mouth": "Mouth", "tail": "Tail", - "topFin": "Top fin", + "topOfFin": "Top of fin", "upperTeeth": "Upper teeth" }, "s": {}, "o": { "hungry": { "t": "Hungry", - "d": "Changes the mouth shape to convey Hi is hungry" + "d": "Changes the belly shape to convey if Hi has just eaten" }, "nosePointiness": { "t": "Nose pointiness", @@ -26,6 +26,14 @@ "t": "Aggressive", "d": "Give Hi pointy teeth, or not" }, + "aggressiveNo": { + "t": "Friendly", + "d": "Hi will have rounded teeth" + }, + "aggressiveYes": { + "t": "Aggressive", + "d": "Hi will have pointy teeth" + }, "size": { "t": "Size", "d": "Sharks come in all sizes, and so does Hi" diff --git a/designs/hi/package.json b/designs/hi/package.json index dd8f0399345..3029be81419 100644 --- a/designs/hi/package.json +++ b/designs/hi/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/hi/src/aboveMouth.mjs b/designs/hi/src/aboveMouth.mjs index 483c45eb1ff..a3a6bec7442 100644 --- a/designs/hi/src/aboveMouth.mjs +++ b/designs/hi/src/aboveMouth.mjs @@ -1,118 +1,117 @@ import { body } from './body.mjs' import { mouth } from './mouth.mjs' -function draftHiAboveMouth({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - let aboveMouth01_02d = 266.7238454769277 * options.size - const aboveMouth01_02a = 353.4089695458119 - const aboveMouth02_03d = 28.348200101593726 * options.size - const aboveMouth02_03a = 233.13495309848912 - let aboveMouth01_04d = 57.858419828059574 * options.size - const aboveMouth01_04a = 208.91023166349467 - const aboveMouth01cp1d = 62.927189989701574 * options.size - const aboveMouth01cp1a = 298.7196048714283 - const aboveMouth02cp2d = 169.53367533325053 * options.size - const aboveMouth02cp2a = 195.1209034747764 - const aboveMouth03cp1d = 172.36585117998288 * options.size - const aboveMouth03cp1a = 197.87876803095696 - const aboveMouth04cp2d = 66.94005927693816 * options.size - const aboveMouth04cp2a = 308.8121959753343 +export const aboveMouth = { + name: 'hi.aboveMouth', + after: [body, mouth], + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') + const faceTopLength = store.get('faceTopLength') - const faceTopLength = store.get('faceTopLength') + let aboveMouth01_02d = 266.7238454769277 * multiplier + const aboveMouth01_02a = 353.4089695458119 + const aboveMouth02_03d = 28.348200101593726 * multiplier + const aboveMouth02_03a = 233.13495309848912 + let aboveMouth01_04d = 57.858419828059574 * multiplier + const aboveMouth01_04a = 208.91023166349467 + const aboveMouth01cp1d = 62.927189989701574 * multiplier + const aboveMouth01cp1a = 298.7196048714283 + const aboveMouth02cp2d = 169.53367533325053 * multiplier + const aboveMouth02cp2a = 195.1209034747764 + const aboveMouth03cp1d = 172.36585117998288 * multiplier + const aboveMouth03cp1a = 197.87876803095696 + const aboveMouth04cp2d = 66.94005927693816 * multiplier + const aboveMouth04cp2a = 308.8121959753343 - let diff = 0 - let iteration = 0 - do { - points.aboveMouth01 = new Point(0, 0) - points.aboveMouth02 = points.aboveMouth01.shift(aboveMouth01_02a, aboveMouth01_02d) - points.aboveMouth03 = points.aboveMouth02.shift(aboveMouth02_03a, aboveMouth02_03d) - points.aboveMouth04 = points.aboveMouth01.shift(aboveMouth01_04a, aboveMouth01_04d) + let diff = 0 + let iteration = 0 + do { + points.aboveMouth01 = new Point(0, 0) + points.aboveMouth02 = points.aboveMouth01.shift(aboveMouth01_02a, aboveMouth01_02d) + points.aboveMouth03 = points.aboveMouth02.shift(aboveMouth02_03a, aboveMouth02_03d) + points.aboveMouth04 = points.aboveMouth01.shift(aboveMouth01_04a, aboveMouth01_04d) - points.aboveMouth01cp1 = points.aboveMouth01.shift(aboveMouth01cp1a, aboveMouth01cp1d) - points.aboveMouth02cp2 = points.aboveMouth02.shift(aboveMouth02cp2a, aboveMouth02cp2d) - points.aboveMouth03cp1 = points.aboveMouth03.shift(aboveMouth03cp1a, aboveMouth03cp1d) - points.aboveMouth04cp2 = points.aboveMouth04.shift(aboveMouth04cp2a, aboveMouth04cp2d) + points.aboveMouth01cp1 = points.aboveMouth01.shift(aboveMouth01cp1a, aboveMouth01cp1d) + points.aboveMouth02cp2 = points.aboveMouth02.shift(aboveMouth02cp2a, aboveMouth02cp2d) + points.aboveMouth03cp1 = points.aboveMouth03.shift(aboveMouth03cp1a, aboveMouth03cp1d) + points.aboveMouth04cp2 = points.aboveMouth04.shift(aboveMouth04cp2a, aboveMouth04cp2d) - diff = - faceTopLength - - new Path() - .move(points.aboveMouth03) - .curve(points.aboveMouth03cp1, points.aboveMouth04cp2, points.aboveMouth04) - .length() + diff = + faceTopLength - + new Path() + .move(points.aboveMouth03) + .curve(points.aboveMouth03cp1, points.aboveMouth04cp2, points.aboveMouth04) + .length() - aboveMouth01_02d = aboveMouth01_02d + diff - aboveMouth01_04d = aboveMouth01_04d + diff - iteration++ - } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + aboveMouth01_02d = aboveMouth01_02d + diff + aboveMouth01_04d = aboveMouth01_04d + diff + iteration++ + } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) - paths.aboveMouthAttachment = new Path() - .move(points.aboveMouth01) - .line(points.aboveMouth04) - .attr('data-text-class', 'text-xs') - paths.bodyAttachment = new Path() - .move(points.aboveMouth04) - .curve(points.aboveMouth04cp2, points.aboveMouth03cp1, points.aboveMouth03) - .attr('data-text-class', 'text-xs') - paths.finAttachment = new Path() - .move(points.aboveMouth03) - .line(points.aboveMouth02) - .attr('data-text-class', 'text-xs') - paths.bellyAndMouthAttachment = new Path() - .move(points.aboveMouth02) - .curve(points.aboveMouth02cp2, points.aboveMouth01cp1, points.aboveMouth01) - paths.seam = new Path() - .move(points.aboveMouth01) - .join(paths.aboveMouthAttachment) - .join(paths.bodyAttachment) - .join(paths.finAttachment) - .join(paths.bellyAndMouthAttachment) - .close() + paths.aboveMouthAttachment = new Path() + .move(points.aboveMouth01) + .line(points.aboveMouth04) + .attr('data-text-class', 'text-xs') + paths.bodyAttachment = new Path() + .move(points.aboveMouth04) + .curve(points.aboveMouth04cp2, points.aboveMouth03cp1, points.aboveMouth03) + .attr('data-text-class', 'text-xs') + paths.finAttachment = new Path() + .move(points.aboveMouth03) + .line(points.aboveMouth02) + .attr('data-text-class', 'text-xs') + paths.bellyAndMouthAttachment = new Path() + .move(points.aboveMouth02) + .curve(points.aboveMouth02cp2, points.aboveMouth01cp1, points.aboveMouth01) + paths.seam = new Path() + .move(points.aboveMouth01) + .join(paths.aboveMouthAttachment) + .join(paths.bodyAttachment) + .join(paths.finAttachment) + .join(paths.bellyAndMouthAttachment) + .close() - store.set('aboveMouthTopLength', paths.bodyAttachment.length()) - store.set('aboveMouthBottomLength', paths.bellyAndMouthAttachment.length()) - store.set('aboveMouthFinLength', points.aboveMouth02.dist(points.aboveMouth03)) + store.set('aboveMouthTopLength', paths.bodyAttachment.length()) + store.set('aboveMouthBottomLength', paths.bellyAndMouthAttachment.length()) + store.set('aboveMouthFinLength', points.aboveMouth02.dist(points.aboveMouth03)) - store.cutlist.addCut({ material: 'color2Belly' }) + store.cutlist.addCut({ cut: 2, material: 'color2Belly' }) + points.gridAnchor = points.aboveMouth04.clone() - // Complete? - if (complete) { points.aboveMouthSnippet = new Path() .move(points.aboveMouth01) .curve(points.aboveMouth01cp1, points.aboveMouth02cp2, points.aboveMouth02) .shiftAlong(store.get('mouthTopLength')) snippets.mouth = new Snippet('bnotch', points.aboveMouthSnippet) + points.aboveMouthBottom = paths.seam.edge('bottom') + points.aboveMouthTop = new Path() + .move(points.aboveMouth01) + .curve(points.aboveMouth01cp1, points.aboveMouth02cp2, points.aboveMouth02) + .edge('bottom') + points.titleAnchor = points.aboveMouth04.shiftFractionTowards(points.aboveMouth01cp1, 0.5) points.logoAnchor = points.aboveMouth01cp1.shiftFractionTowards(points.aboveMouth02cp2, 0.5) snippets.logo = new Snippet('logo', points.logoAnchor).attr( 'data-scale', - (options.size > 1 ? 1 : options.size) / 4 + (multiplier > 1 ? 1 : multiplier) / 4 ) macro('title', { at: points.titleAnchor, nr: 5, title: 'aboveMouth', - scale: options.size / 2, + scale: multiplier / 2, }) + let split = paths.bellyAndMouthAttachment.split(points.aboveMouthSnippet) + paths.bellyAttachment = split[0].attr('data-text-class', 'text-xs') + paths.mouthAttachment = split[1].attr('data-text-class', 'text-xs') macro('banner', { path: paths.aboveMouthAttachment, text: 'aboveMouth', + id: 'aboveMouth', dy: -0, spaces: 0, repeat: 1, @@ -120,6 +119,7 @@ function draftHiAboveMouth({ macro('banner', { path: paths.bodyAttachment, text: 'body', + id: 'body', dy: 0, spaces: 10, repeat: 7, @@ -127,97 +127,80 @@ function draftHiAboveMouth({ macro('banner', { path: paths.finAttachment, text: '+', + id: 'plus', dy: 0, spaces: 0, repeat: 4, }) - let split = paths.bellyAndMouthAttachment.split(points.aboveMouthSnippet) - paths.bellyAttachment = split[0].attr('data-text-class', 'text-xs') macro('banner', { path: paths.bellyAttachment, text: 'belly', + id: 'belly', dy: 0, spaces: 4, repeat: 3, }) - paths.mouthAttachment = split[1].attr('data-text-class', 'text-xs') macro('banner', { path: paths.mouthAttachment, text: 'mouth', + id: 'mouth', dy: 0, spaces: 4, repeat: 3, }) - if (paperless) { - macro('hd', { - from: points.aboveMouth04, - to: points.aboveMouth01, - y: points.aboveMouth01.y - sa - 10, - }) - macro('hd', { - from: points.aboveMouth01, - to: points.aboveMouth02, - y: points.aboveMouth01.y - sa - 10, - }) - macro('hd', { - from: points.aboveMouthSnippet, - to: points.aboveMouth02, - y: points.aboveMouth01.y, - }) - macro('vd', { - from: points.aboveMouth04, - to: points.aboveMouth01, - x: points.aboveMouth04.x - sa - 15, - noStartMarker: true, - noEndMarker: true, - }) - points.aboveMouthBottom = paths.seam.edge('bottom') - points.aboveMouthTop = new Path() - .move(points.aboveMouth01) - .curve(points.aboveMouth01cp1, points.aboveMouth02cp2, points.aboveMouth02) - .edge('bottom') - - macro('vd', { - from: points.aboveMouthBottom, - to: points.aboveMouth04, - x: points.aboveMouth04.x - sa - 15, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.aboveMouthBottom, - to: points.aboveMouthTop, - x: points.aboveMouth04.x - sa, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.aboveMouth02, - to: points.aboveMouth03, - x: points.aboveMouth02.x + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.aboveMouth03, - to: points.aboveMouthBottom, - x: points.aboveMouth02.x + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - } + macro('hd', { + from: points.aboveMouth04, + to: points.aboveMouth01, + y: points.aboveMouth01.y - sa - 10, + id: 'widthCorners', + }) + macro('hd', { + from: points.aboveMouth01, + to: points.aboveMouth02, + y: points.aboveMouth01.y - sa - 10, + id: 'cornerToMid', + }) + macro('hd', { + from: points.aboveMouthSnippet, + to: points.aboveMouth02, + y: points.aboveMouth01.y, + id: 'widthToSnippet', + }) + macro('vd', { + from: points.aboveMouth04, + to: points.aboveMouth01, + x: points.aboveMouth04.x - sa - 15, + }) + macro('vd', { + from: points.aboveMouthBottom, + to: points.aboveMouth04, + x: points.aboveMouth04.x - sa - 15, + id: 'bottomToCornerLeft', + }) + macro('vd', { + from: points.aboveMouthBottom, + to: points.aboveMouthTop, + x: points.aboveMouth04.x - sa, + id: 'minimalHeight', + }) + macro('vd', { + from: points.aboveMouth02, + to: points.aboveMouth03, + x: points.aboveMouth02.x + sa + 10, + id: 'heightCornersRight', + }) + macro('vd', { + from: points.aboveMouth03, + to: points.aboveMouthBottom, + x: points.aboveMouth02.x + sa + 10, + id: 'bottomToCornerRight', + }) if (sa) { paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') } - } - return part -} - -export const aboveMouth = { - name: 'hi.aboveMouth', - after: [body, mouth], - draft: draftHiAboveMouth, + return part + }, } diff --git a/designs/hi/src/belly.mjs b/designs/hi/src/belly.mjs index f88c29d61d0..146eb189267 100644 --- a/designs/hi/src/belly.mjs +++ b/designs/hi/src/belly.mjs @@ -1,202 +1,209 @@ import { body } from './body.mjs' import { aboveMouth } from './aboveMouth.mjs' -function draftHiBelly({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - const belly01_02d = 224.8451041 * options.size - const belly02_03d = 108.1988389 * options.size - const belly03_04d = 216.7485605 * options.size - const belly01_10d = 129.2449198 * options.size - const belly01_02a = 25.7020193 - const belly02_03a = 2.2164353 - const belly03_04a = 338.0869319 +export const belly = { + name: 'hi.belly', + after: [body, aboveMouth], + options: { + hungry: { pct: 50, min: 0, max: 100, menu: 'style' }, + }, + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, options, macro, part }) => { + const multiplier = store.get('multiplier') + const bellyTailLength = store.get('bellyTailLength') - const belly01_10a = 163.4959859 - const belly10_05d = 231.4386252 * options.size - const belly10_05a = 0 + const belly01_02d = 224.8451041 * multiplier + const belly02_03d = 108.1988389 * multiplier + const belly03_04d = 216.7485605 * multiplier + const belly01_10d = 129.2449198 * multiplier + const belly01_02a = 25.7020193 + const belly02_03a = 2.2164353 + const belly03_04a = 338.0869319 - const belly01cp1d = 65.65512143 * options.size - const belly01cp2d = 38.20949996 * options.size - const belly02cp1d = 37.73513423 * options.size - const belly02cp2d = 118.6453123 * options.size - const belly03cp1d = 54.50254779 * options.size - const belly03cp2d = 40.6827883 * options.size - const belly04cp1d = 52.08589469 * options.size - const belly04cp2d = 62.46560129 * options.size - const belly05cp1d = 48.20828587 * options.size - const belly05cp2d = 68 * options.size - const belly10cp2d = 65.42602302 * options.size + const belly01_10a = 163.4959859 + const belly10_05d = 231.4386252 * multiplier + const belly10_05a = 0 - const belly01cp1a = 60.117233 - const belly01cp2a = 327.4394109 - const belly02cp1a = 331.7898702 - const belly02cp2a = 182.9449647 - const belly03cp1a = 349.861397 - const belly03cp2a = 200.1533738 - const belly04cp1a = 204.8857575 - const belly04cp2a = 145.9357065 - const belly05cp1a = 8.1545383 - const belly05cp2a = 5 - const belly10cp2a = 175.9644604 + const belly01cp1d = 65.65512143 * multiplier + const belly01cp2d = 38.20949996 * multiplier + const belly02cp1d = 37.73513423 * multiplier + const belly02cp2d = 118.6453123 * multiplier + const belly03cp1d = 54.50254779 * multiplier + const belly03cp2d = 40.6827883 * multiplier + const belly04cp1d = 52.08589469 * multiplier + const belly04cp2d = 62.46560129 * multiplier + const belly05cp1d = 48.20828587 * multiplier + const belly05cp2d = 68 * multiplier + const belly10cp2d = 65.42602302 * multiplier - points.belly10 = new Point(0, 0) - points.belly01 = points.belly10.shift(belly01_10a, belly01_10d) - points.belly02 = points.belly01.shift(belly01_02a, belly01_02d) - points.belly03 = points.belly02.shift(belly02_03a, belly02_03d) - points.belly04 = points.belly03.shift(belly03_04a, belly03_04d) - points.belly05 = points.belly10.shift(belly10_05a, belly10_05d) + const belly01cp1a = 60.117233 + const belly01cp2a = 327.4394109 + const belly02cp1a = 331.7898702 + const belly02cp2a = 182.9449647 + const belly03cp1a = 349.861397 + const belly03cp2a = 200.1533738 + const belly04cp1a = 204.8857575 + const belly04cp2a = 145.9357065 + const belly05cp1a = 8.1545383 + const belly05cp2a = 5 + const belly10cp2a = 175.9644604 - points.belly01.y = points.belly01.y * (1.1 - options.hungry / 5) - points.belly02.y = points.belly02.y * (1.1 - options.hungry / 5) - points.belly03.y = points.belly03.y * (1.1 - options.hungry / 5) - points.belly04.y = points.belly04.y * (1.1 - options.hungry / 5) + points.belly10 = new Point(0, 0) + points.belly01 = points.belly10.shift(belly01_10a, belly01_10d) + points.belly02 = points.belly01.shift(belly01_02a, belly01_02d) + points.belly03 = points.belly02.shift(belly02_03a, belly02_03d) + points.belly04 = points.belly03.shift(belly03_04a, belly03_04d) + points.belly05 = points.belly10.shift(belly10_05a, belly10_05d) - points.belly01cp1 = points.belly01.shift(belly01cp1a, belly01cp1d) - points.belly02cp1 = points.belly02.shift(belly02cp1a, belly02cp1d) - points.belly03cp1 = points.belly03.shift(belly03cp1a, belly03cp1d) - points.belly04cp1 = points.belly04.shift(belly04cp1a, belly04cp1d) - points.belly05cp1 = points.belly05.shift(belly05cp1a, belly05cp1d) - points.belly01cp2 = points.belly01.shift(belly01cp2a, belly01cp2d) - points.belly02cp2 = points.belly02.shift(belly02cp2a, belly02cp2d) - points.belly03cp2 = points.belly03.shift(belly03cp2a, belly03cp2d) - points.belly04cp2 = points.belly04.shift(belly04cp2a, belly04cp2d) - points.belly05cp2 = points.belly05.shift(belly05cp2a, belly05cp2d) - points.belly10cp1 = points.belly10.shift(belly10cp2a, belly10cp2d) + points.belly01.y = points.belly01.y * (1.1 - options.hungry / 5) + points.belly02.y = points.belly02.y * (1.1 - options.hungry / 5) + points.belly03.y = points.belly03.y * (1.1 - options.hungry / 5) + points.belly04.y = points.belly04.y * (1.1 - options.hungry / 5) - const mouthPartLength = - store.get('aboveMouthBottomLength') - - store.get('mouthTopLength') + - store.get('mouthBottomLength') + points.belly01cp1 = points.belly01.shift(belly01cp1a, belly01cp1d) + points.belly02cp1 = points.belly02.shift(belly02cp1a, belly02cp1d) + points.belly03cp1 = points.belly03.shift(belly03cp1a, belly03cp1d) + points.belly04cp1 = points.belly04.shift(belly04cp1a, belly04cp1d) + points.belly05cp1 = points.belly05.shift(belly05cp1a, belly05cp1d) + points.belly01cp2 = points.belly01.shift(belly01cp2a, belly01cp2d) + points.belly02cp2 = points.belly02.shift(belly02cp2a, belly02cp2d) + points.belly03cp2 = points.belly03.shift(belly03cp2a, belly03cp2d) + points.belly04cp2 = points.belly04.shift(belly04cp2a, belly04cp2d) + points.belly05cp2 = points.belly05.shift(belly05cp2a, belly05cp2d) + points.belly10cp1 = points.belly10.shift(belly10cp2a, belly10cp2d) - let diff = 0 - let iteration = 0 - do { - points.belly01.x -= diff - points.belly01cp1.x -= diff - points.belly01cp2.x -= diff + const mouthPartLength = + store.get('aboveMouthBottomLength') - + store.get('mouthTopLength') + + store.get('mouthBottomLength') - iteration++ - diff = - mouthPartLength - - new Path() - .move(points.belly01) - .curve(points.belly01cp1, points.belly02cp2, points.belly02) - .length() - } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + let diff = 0 + let iteration = 0 + do { + points.belly01.x -= diff + points.belly01cp1.x -= diff + points.belly01cp2.x -= diff - const bellyTailLength = store.get('bellyTailLength') + iteration++ + diff = + mouthPartLength - + new Path() + .move(points.belly01) + .curve(points.belly01cp1, points.belly02cp2, points.belly02) + .length() + } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) - diff = 0 - iteration = 0 - do { - points.belly04.x += diff - points.belly04cp1.x += diff - points.belly04cp2.x += diff - points.belly05.x += diff - points.belly05cp2.x += diff + diff = 0 + iteration = 0 + do { + points.belly04.x += diff + points.belly04cp1.x += diff + points.belly04cp2.x += diff + points.belly05.x += diff + points.belly05cp2.x += diff - iteration++ - diff = - bellyTailLength - - new Path() - .move(points.belly03) - .curve(points.belly03cp1, points.belly04cp2, points.belly04) - .length() - } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + iteration++ + diff = + bellyTailLength - + new Path() + .move(points.belly03) + .curve(points.belly03cp1, points.belly04cp2, points.belly04) + .length() + } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) - points.belly05cp1 = points.belly05cp2.flipY() - points.belly06 = points.belly04.flipY() - points.belly06cp1 = points.belly04cp2.flipY() - points.belly06cp2 = points.belly04cp1.flipY() - points.belly07 = points.belly03.flipY() - points.belly07cp1 = points.belly03cp2.flipY() - points.belly07cp2 = points.belly03cp1.flipY() - points.belly08 = points.belly02.flipY() - points.belly08cp1 = points.belly02cp2.flipY() - points.belly08cp2 = points.belly02cp1.flipY() - points.belly09 = points.belly01.flipY() - points.belly09cp1 = points.belly01cp2.flipY() - points.belly09cp2 = points.belly01cp1.flipY() - points.belly10cp2 = points.belly10cp1.flipY() + points.belly05cp1 = points.belly05cp2.flipY() + points.belly06 = points.belly04.flipY() + points.belly06cp1 = points.belly04cp2.flipY() + points.belly06cp2 = points.belly04cp1.flipY() + points.belly07 = points.belly03.flipY() + points.belly07cp1 = points.belly03cp2.flipY() + points.belly07cp2 = points.belly03cp1.flipY() + points.belly08 = points.belly02.flipY() + points.belly08cp1 = points.belly02cp2.flipY() + points.belly08cp2 = points.belly02cp1.flipY() + points.belly09 = points.belly01.flipY() + points.belly09cp1 = points.belly01cp2.flipY() + points.belly09cp2 = points.belly01cp1.flipY() + points.belly10cp2 = points.belly10cp1.flipY() - paths.body1 = new Path() - .move(points.belly04) - .curve(points.belly04cp2, points.belly03cp1, points.belly03) - .attr('data-text-class', 'text-xs') - paths.body2 = new Path() - .move(points.belly07) - .curve(points.belly07cp2, points.belly06cp1, points.belly06) - .attr('data-text-class', 'text-xs') - paths.finAttachmentBelly1 = new Path() - .move(points.belly03) - .curve(points.belly03cp2, points.belly02cp1, points.belly02) - .attr('data-text-class', 'text-xs') - paths.finAttachmentBelly2 = new Path() - .move(points.belly08) - .curve(points.belly08cp2, points.belly07cp1, points.belly07) - .attr('data-text-class', 'text-xs') - paths.mouthAttachment1 = new Path() - .move(points.belly02) - .curve(points.belly02cp2, points.belly01cp1, points.belly01) - paths.mouthAttachment2 = new Path() - .move(points.belly09) - .curve(points.belly09cp2, points.belly08cp1, points.belly08) - - paths.top = new Path() - .move(points.belly04) - .join(paths.body1) - .join(paths.finAttachmentBelly1) - .join(paths.mouthAttachment1) - .hide() - paths.bottom = new Path() - .move(points.belly09) - .join(paths.mouthAttachment2) - .join(paths.finAttachmentBelly2) - .join(paths.body2) - .hide() - paths.seam = new Path() - .move(points.belly01) - .curve(points.belly01cp2, points.belly10cp1, points.belly10) - .curve(points.belly10cp2, points.belly09cp1, points.belly09) - .join(paths.bottom) - .curve(points.belly06cp2, points.belly05cp1, points.belly05) - .curve(points.belly05cp2, points.belly04cp1, points.belly04) - .join(paths.top) - .close() - .unhide() - - store.set( - 'bellyFinLength', - new Path() + paths.body1 = new Path() + .move(points.belly04) + .curve(points.belly04cp2, points.belly03cp1, points.belly03) + .attr('data-text-class', 'text-xs') + paths.body2 = new Path() + .move(points.belly07) + .curve(points.belly07cp2, points.belly06cp1, points.belly06) + .attr('data-text-class', 'text-xs') + paths.finAttachmentBelly1 = new Path() + .move(points.belly03) + .curve(points.belly03cp2, points.belly02cp1, points.belly02) + .attr('data-text-class', 'text-xs') + paths.finAttachmentBelly2 = new Path() + .move(points.belly08) + .curve(points.belly08cp2, points.belly07cp1, points.belly07) + .attr('data-text-class', 'text-xs') + paths.mouthAttachment1 = new Path() .move(points.belly02) - .curve(points.belly02cp1, points.belly03cp2, points.belly03) - .length() - ) + .curve(points.belly02cp2, points.belly01cp1, points.belly01) + paths.mouthAttachment2 = new Path() + .move(points.belly09) + .curve(points.belly09cp2, points.belly08cp1, points.belly08) - points.grainlineFrom = new Point(points.belly10.x, points.belly02.y * 0.7) - points.grainlineTo = new Point(points.belly05.x, points.belly02.y * 0.7) - macro('grainline', { - from: points.grainlineFrom, - to: points.grainlineTo, - }) + paths.top = new Path() + .move(points.belly04) + .join(paths.body1) + .join(paths.finAttachmentBelly1) + .join(paths.mouthAttachment1) + .hide() + paths.bottom = new Path() + .move(points.belly09) + .join(paths.mouthAttachment2) + .join(paths.finAttachmentBelly2) + .join(paths.body2) + .hide() + paths.seam = new Path() + .move(points.belly01) + .curve(points.belly01cp2, points.belly10cp1, points.belly10) + .curve(points.belly10cp2, points.belly09cp1, points.belly09) + .join(paths.bottom) + .curve(points.belly06cp2, points.belly05cp1, points.belly05) + .curve(points.belly05cp2, points.belly04cp1, points.belly04) + .join(paths.top) + .close() + .unhide() - store.cutlist.addCut({ cut: 1, material: 'color2Belly' }) + store.set( + 'bellyFinLength', + new Path() + .move(points.belly02) + .curve(points.belly02cp1, points.belly03cp2, points.belly03) + .length() + ) + + points.grainlineFrom = new Point(points.belly10.x, points.belly02.y * 0.7) + points.grainlineTo = new Point(points.belly05.x, points.belly02.y * 0.7) + macro('grainline', { + from: points.grainlineFrom, + to: points.grainlineTo, + }) + + store.cutlist.addCut({ cut: 1, material: 'color2Belly' }) + + points.titleAnchor = points.belly05.shiftFractionTowards(points.belly10, 0.5) + points.logoAnchor = points.belly10.shiftFractionTowards(points.titleAnchor, 0.5) + points.gridAnchor = points.titleAnchor.clone() + + snippets.logo = new Snippet('logo', points.logoAnchor).attr( + 'data-scale', + multiplier > 1 ? 1 : multiplier + ) + + macro('title', { + at: points.titleAnchor, + nr: 2, + title: 'belly', + scale: multiplier, + }) - // Complete? - if (complete) { points.bellyMouthSnippet1 = paths.mouthAttachment1 .reverse() .shiftAlong(store.get('mouthBottomLength')) @@ -210,6 +217,7 @@ function draftHiBelly({ macro('banner', { path: paths.finAttachmentBelly1, text: '-o-', + id: 'circles1', dy: 0, spaces: 3, repeat: 7, @@ -217,6 +225,7 @@ function draftHiBelly({ macro('banner', { path: paths.finAttachmentBelly2, text: '-o-', + id: 'circles2', dy: 0, spaces: 3, repeat: 7, @@ -232,6 +241,7 @@ function draftHiBelly({ macro('banner', { path: paths.mouth1, text: 'mouth', + id: 'mouth1', dy: 0, spaces: 3, repeat: 3, @@ -239,6 +249,7 @@ function draftHiBelly({ macro('banner', { path: paths.mouth2, text: 'mouth', + id: 'mouth2', dy: 0, spaces: 3, repeat: 3, @@ -246,6 +257,7 @@ function draftHiBelly({ macro('banner', { path: paths.body1, text: 'body', + id: 'body1', dy: 0, spaces: 3, repeat: 3, @@ -253,6 +265,7 @@ function draftHiBelly({ macro('banner', { path: paths.body2, text: 'body', + id: 'body2', dy: 0, spaces: 3, repeat: 3, @@ -260,6 +273,7 @@ function draftHiBelly({ macro('banner', { path: paths.aboveMouth1, text: 'aboveMouth', + id: 'aboveMouth1', dy: 0, spaces: 3, repeat: 3, @@ -267,139 +281,96 @@ function draftHiBelly({ macro('banner', { path: paths.aboveMouth2, text: 'aboveMouth', + id: 'aboveMouth2', dy: 0, spaces: 3, repeat: 3, }) - if (paperless) { - macro('hd', { - from: points.belly01, - to: points.belly10, - y: points.belly01.y, - }) - macro('hd', { - from: points.belly05, - to: points.belly04, - y: points.belly04.y, - }) - macro('hd', { - from: points.belly10, - to: points.belly05, - y: (points.belly04.y + points.belly01.y) / 2, - }) - macro('hd', { - from: points.belly01, - to: points.belly02, - y: points.belly02.y - sa - 10, - }) - macro('hd', { - from: points.belly02, - to: points.belly03, - y: points.belly02.y - sa - 10, - }) - macro('hd', { - from: points.belly03, - to: points.belly04, - y: points.belly02.y - sa - 10, - }) - macro('hd', { - from: points.bellyMouthSnippet1, - to: points.belly02, - y: points.bellyMouthSnippet1.y, - }) + macro('hd', { + from: points.belly01, + to: points.belly10, + y: points.belly01.y, + id: 'depthLeftDart', + }) + macro('hd', { + from: points.belly05, + to: points.belly04, + y: points.belly04.y, + id: 'depthRightDart', + }) + macro('hd', { + from: points.belly10, + to: points.belly05, + y: (points.belly04.y + points.belly01.y) / 2, + id: 'widthbetweenDarts', + }) + macro('hd', { + from: points.belly01, + to: points.belly02, + y: points.belly02.y - sa - 10, + id: 'leftToFin', + }) + macro('hd', { + from: points.belly02, + to: points.belly03, + y: points.belly02.y - sa - 10, + id: 'finWidth', + }) + macro('hd', { + from: points.belly03, + to: points.belly04, + y: points.belly02.y - sa - 10, + id: 'rightToFin', + }) + macro('hd', { + from: points.bellyMouthSnippet1, + to: points.belly02, + y: points.bellyMouthSnippet1.y, + id: 'finToSnippet', + }) - macro('vd', { - from: points.belly03, - to: points.belly05, - x: points.belly03.x, - }) - macro('vd', { - from: points.belly05, - to: points.belly07, - x: points.belly03.x, - }) - macro('vd', { - from: points.belly10, - to: points.belly02, - x: points.belly02.x, - }) - macro('vd', { - from: points.belly08, - to: points.belly10, - x: points.belly02.x, - }) - macro('vd', { - from: points.belly10, - to: points.belly01, - x: points.belly01.x - sa - 10, - }) - macro('vd', { - from: points.belly09, - to: points.belly10, - x: points.belly01.x - sa - 10, - }) - macro('vd', { - from: points.belly09, - to: points.belly08, - x: points.belly01.x - sa - 10, - }) - macro('vd', { - from: points.belly02, - to: points.belly01, - x: points.belly01.x - sa - 10, - }) - macro('vd', { - from: points.belly05, - to: points.belly06, - x: points.belly04.x + sa + 10, - }) - macro('vd', { - from: points.belly04, - to: points.belly05, - x: points.belly04.x + sa + 10, - }) - macro('vd', { - from: points.belly06, - to: points.belly07, - x: points.belly04.x + sa + 10, - }) - macro('vd', { - from: points.belly03, - to: points.belly04, - x: points.belly04.x + sa + 10, - }) - - points.titleAnchor = points.belly02.shiftFractionTowards(points.belly07, 0.5) - } else { - points.titleAnchor = points.belly03.shiftFractionTowards(points.belly07, 0.5) - points.logoAnchor = points.belly02.shiftFractionTowards(points.belly08, 0.5) - - snippets.logo = new Snippet('logo', points.logoAnchor).attr( - 'data-scale', - options.size > 1 ? 1 : options.size - ) - } - macro('title', { - at: points.titleAnchor, - nr: 2, - title: 'belly', - scale: options.size, + macro('vd', { + from: points.belly05, + to: points.belly07, + x: points.belly03.x, + id: 'rightFinToMiddle', + }) + macro('vd', { + from: points.belly08, + to: points.belly10, + x: points.belly02.x, + id: 'leftFinToMiddle', + }) + macro('vd', { + from: points.belly09, + to: points.belly10, + x: points.belly01.x - sa - 10, + id: 'heightLeftDart', + }) + macro('vd', { + from: points.belly09, + to: points.belly08, + x: points.belly01.x - sa - 10, + id: 'heightLeft', + }) + macro('vd', { + from: points.belly05, + to: points.belly06, + x: points.belly04.x + sa + 10, + id: 'heightRightDart', + }) + macro('vd', { + from: points.belly06, + to: points.belly07, + x: points.belly04.x + sa + 10, + id: 'heightRight', }) if (sa) { paths.sa = paths.bottom.join(paths.top).close().offset(sa).attr('class', 'fabric sa') } - } - return part -} - -export const belly = { - name: 'hi.belly', - after: [body, aboveMouth], - options: { - hungry: { pct: 50, min: 0, max: 100, menu: 'style' }, + return part }, - draft: draftHiBelly, } diff --git a/designs/hi/src/body.mjs b/designs/hi/src/body.mjs index 9dd8c5dc76e..9bc0957e7b9 100644 --- a/designs/hi/src/body.mjs +++ b/designs/hi/src/body.mjs @@ -1,417 +1,450 @@ -function draftHiBody({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - utils, - part, -}) { - const body01_02d = 117.67274991262845 * options.size - const body02_03d = 124.91298035032229 * options.size - const body03_04d = 255.92397474640785 * options.size - const body04_05d = 201.01260719168837 * options.size - const body05_06d = 134.89080971660005 * options.size - const body06_07d = 49.0386070356816 * options.size - const body07_08d = 225.86340480918992 * options.size - const body08_09d = 66.84760000179512 * options.size - const body09_10d = 40.7278200374142 * options.size - const body10_11d = 23.78799421977402 * options.size - const body11_12d = 57.68530918700182 * options.size - const body12_13d = 98.0662397820983 * options.size - const body13_14d = 91.32736600274856 * options.size - const body14_15d = 295.1097706682888 * options.size - const body15_16d = 209.4263335058177 * options.size - const body16_17d = 152.51537318250902 * options.size - const body17_18d = 255.15294373571314 * options.size - const body18_19d = 71.90453921693678 * options.size +const length = 1000 - const body01cp1d = 32.13103487929059 * options.size - const body01cp2d = 23.72518967258217 * options.size - const body02cp1d = 44.99353642469105 * options.size - const body02cp2d = 42.33568754608812 * options.size - const body03cp1d = 62.59332758369697 * options.size - const body03cp2d = 40.89285869195256 * options.size - const body04cp1d = 176.21501525125487 * options.size - const body04cp2d = 130.11389715553065 * options.size - const body05cp1d = 29.56689479806765 * options.size - const body05cp2d = 104.66860665930352 * options.size - const body06cp1d = 8.03497915367552 * options.size - const body06cp2d = 34.57808908832297 * options.size - const body07cp1d = 89.11908088619404 * options.size - const body07cp2d = 25.54827831772624 * options.size - const body08cp1d = 41.24120086757895 * options.size - const body08cp2d = 158.23693200387828 * options.size - const body09cp1d = 4.87663090668135 * options.size - const body09cp2d = 25.76988630165065 * options.size - const body10cp1d = 4.13950105689086 * options.size - const body10cp2d = 13.2750849338149 * options.size - const body11cp1d = 17.66659910678904 * options.size - const body11cp2d = 17.66533107530116 * options.size - const body12cp1d = 14.46914569005365 * options.size - const body12cp2d = 39.51915145850176 * options.size - const body13cp1d = 35.66832366400192 * options.size - const body13cp2d = 48.53828530139895 * options.size - const body14cp1d = 77.2603605608982 * options.size - const body14cp2d = 37.42741381661305 * options.size - const body15cp1d = 74.89746640634775 * options.size - const body15cp2d = 101.16048880857042 * options.size - const body16cp1d = 36.21092864039804 * options.size - const body16cp2d = 63.69410844026312 * options.size - const body17cp1d = 97.90988675818191 * options.size - const body17cp2d = 62.08991689477443 * options.size - const body18cp1d = 22.74982929606286 * options.size - const body18cp2d = 16.57960183478481 * options.size - const body19cp1d = 23.95674278778315 * options.size - const body19cp2d = 24.49741270011998 * options.size +export const body = { + name: 'hi.body', + options: { + length, + size: { + pct: 100, + min: 5, + max: 500, + menu: 'style', + toAbs: (val, { options }) => (options?.length ? options.length * val : length * val), + fromAbs: (val, { options }) => + options?.length + ? Math.round((10000 * val) / options.length) / 10000 + : Math.round((10000 * val) / length) / 10000, + }, + nosePointiness: { pct: 0, min: -5, max: +10, menu: 'style' }, + aggressive: { bool: false, menu: 'style' }, + }, + draft: ({ + store, + sa, + Point, + points, + Path, + paths, + Snippet, + snippets, + complete, + options, + macro, + utils, + part, + }) => { + const multiplier = (length / 1000) * options.size + store.set('multiplier', multiplier) - const eyeBigDist = 180.18315182058507 * options.size - const eyeSmallDist = 2.3629811679317316 * options.size + const body01_02d = 117.67274991262845 * multiplier + const body02_03d = 124.91298035032229 * multiplier + const body03_04d = 255.92397474640785 * multiplier + const body04_05d = 201.01260719168837 * multiplier + const body05_06d = 134.89080971660005 * multiplier + const body06_07d = 49.0386070356816 * multiplier + const body07_08d = 225.86340480918992 * multiplier + const body08_09d = 66.84760000179512 * multiplier + const body09_10d = 40.7278200374142 * multiplier + const body10_11d = 23.78799421977402 * multiplier + const body11_12d = 57.68530918700182 * multiplier + const body12_13d = 98.0662397820983 * multiplier + const body13_14d = 91.32736600274856 * multiplier + const body14_15d = 295.1097706682888 * multiplier + const body15_16d = 209.4263335058177 * multiplier + const body16_17d = 152.51537318250902 * multiplier + const body17_18d = 255.15294373571314 * multiplier + const body18_19d = 71.90453921693678 * multiplier - const gillLength = 41.01907104018812 * options.size + const body01cp1d = 32.13103487929059 * multiplier + const body01cp2d = 23.72518967258217 * multiplier + const body02cp1d = 44.99353642469105 * multiplier + const body02cp2d = 42.33568754608812 * multiplier + const body03cp1d = 62.59332758369697 * multiplier + const body03cp2d = 40.89285869195256 * multiplier + const body04cp1d = 176.21501525125487 * multiplier + const body04cp2d = 130.11389715553065 * multiplier + const body05cp1d = 29.56689479806765 * multiplier + const body05cp2d = 104.66860665930352 * multiplier + const body06cp1d = 8.03497915367552 * multiplier + const body06cp2d = 34.57808908832297 * multiplier + const body07cp1d = 89.11908088619404 * multiplier + const body07cp2d = 25.54827831772624 * multiplier + const body08cp1d = 41.24120086757895 * multiplier + const body08cp2d = 158.23693200387828 * multiplier + const body09cp1d = 4.87663090668135 * multiplier + const body09cp2d = 25.76988630165065 * multiplier + const body10cp1d = 4.13950105689086 * multiplier + const body10cp2d = 13.2750849338149 * multiplier + const body11cp1d = 17.66659910678904 * multiplier + const body11cp2d = 17.66533107530116 * multiplier + const body12cp1d = 14.46914569005365 * multiplier + const body12cp2d = 39.51915145850176 * multiplier + const body13cp1d = 35.66832366400192 * multiplier + const body13cp2d = 48.53828530139895 * multiplier + const body14cp1d = 77.2603605608982 * multiplier + const body14cp2d = 37.42741381661305 * multiplier + const body15cp1d = 74.89746640634775 * multiplier + const body15cp2d = 101.16048880857042 * multiplier + const body16cp1d = 36.21092864039804 * multiplier + const body16cp2d = 63.69410844026312 * multiplier + const body17cp1d = 97.90988675818191 * multiplier + const body17cp2d = 62.08991689477443 * multiplier + const body18cp1d = 22.74982929606286 * multiplier + const body18cp2d = 16.57960183478481 * multiplier + const body19cp1d = 23.95674278778315 * multiplier + const body19cp2d = 24.49741270011998 * multiplier - const body01_02a = 170.1382393 - const body02_03a = 39.2280236 - const body03_04a = 159.6914424 - const body04_05a = 147.5949161 - const body05_06a = 128.0581973 - const body06_07a = 253.6604388 - const body07_08a = 225.7462208 - const body08_09a = 157.5894683 - const body09_10a = 125.1280145 - const body10_11a = 242.0485099 - const body11_12a = 211.5926663 - const body12_13a = 171.354716 - const body13_14a = 245.2915054 - const body14_15a = 326.7578209 - const body15_16a = 359.0692249 - const body16_17a = 353.6138832 - const body17_18a = 2.546389668 - const body18_19a = 348.3450181 + const eyeBigDist = 180.18315182058507 * multiplier + const eyeSmallDist = 2.3629811679317316 * multiplier - let body01cp1a = 161.5263465 - const body01cp2a = 255.6503959 - const body02cp1a = 31.95354992 - const body02cp2a = 10 + const gillLength = 41.01907104018812 * multiplier - const body03cp1a = 142.8538439 - const body03cp2a = 225.3745028 - const body04cp1a = 169.1071046 - const body04cp2a = 350.7775897 - const body05cp1a = 105.1596015 - const body05cp2a = 288.5890112 - const body06cp1a = 221.1852544 - const body06cp2a = 344.141322 - const body07cp1a = 267.2041495 - const body07cp2a = 87.03164984 - const body08cp1a = 177.4386949 - const body08cp2a = 358.5040423 - const body09cp1a = 119.4140746 - const body09cp2a = 299.4139506 - const body10cp1a = 219.0878163 - const body10cp2a = 311.9955535 - const body11cp1a = 251.2799387 - const body11cp2a = 71.28196954 - const body12cp1a = 175.0877187 - const body12cp2a = 355.087783 - const body13cp1a = 260.2392636 - const body13cp2a = 351.4909474 - const body14cp1a = 320.929847 - const body14cp2a = 56.95148863 - const body15cp1a = 22.55298719 - const body15cp2a = 153.1212844 - const body16cp1a = 13.89041491 - const body16cp2a = 141.0219905 - const body17cp1a = 11.04287338 - const body17cp2a = 138.4852424 - const body18cp1a = 356.968813 - const body18cp2a = 178.1542839 - const body19cp1a = 51.33608313 - const body19cp2a = 158.5586388 + const body01_02a = 170.1382393 + const body02_03a = 39.2280236 + const body03_04a = 159.6914424 + const body04_05a = 147.5949161 + const body05_06a = 128.0581973 + const body06_07a = 253.6604388 + const body07_08a = 225.7462208 + const body08_09a = 157.5894683 + const body09_10a = 125.1280145 + const body10_11a = 242.0485099 + const body11_12a = 211.5926663 + const body12_13a = 171.354716 + const body13_14a = 245.2915054 + const body14_15a = 326.7578209 + const body15_16a = 359.0692249 + const body16_17a = 353.6138832 + const body17_18a = 2.546389668 + const body18_19a = 348.3450181 - const eyeBigAngle = 184.8499937 - const eyeSmallAngle = 151.2656912 + let body01cp1a = 161.5263465 + const body01cp2a = 255.6503959 + const body02cp1a = 31.95354992 + const body02cp2a = 10 - const gillAngle = 103.9416747 + const body03cp1a = 142.8538439 + const body03cp2a = 225.3745028 + const body04cp1a = 169.1071046 + const body04cp2a = 350.7775897 + const body05cp1a = 105.1596015 + const body05cp2a = 288.5890112 + const body06cp1a = 221.1852544 + const body06cp2a = 344.141322 + const body07cp1a = 267.2041495 + const body07cp2a = 87.03164984 + const body08cp1a = 177.4386949 + const body08cp2a = 358.5040423 + const body09cp1a = 119.4140746 + const body09cp2a = 299.4139506 + const body10cp1a = 219.0878163 + const body10cp2a = 311.9955535 + const body11cp1a = 251.2799387 + const body11cp2a = 71.28196954 + const body12cp1a = 175.0877187 + const body12cp2a = 355.087783 + const body13cp1a = 260.2392636 + const body13cp2a = 351.4909474 + const body14cp1a = 320.929847 + const body14cp2a = 56.95148863 + const body15cp1a = 22.55298719 + const body15cp2a = 153.1212844 + const body16cp1a = 13.89041491 + const body16cp2a = 141.0219905 + const body17cp1a = 11.04287338 + const body17cp2a = 138.4852424 + const body18cp1a = 356.968813 + const body18cp2a = 178.1542839 + const body19cp1a = 51.33608313 + const body19cp2a = 158.5586388 - points.body01 = new Point(0, 0) - points.body02 = points.body01.shift(body01_02a, body01_02d) - points.body03 = points.body02.shift(body02_03a, body02_03d) - points.body04 = points.body03.shift(body03_04a, body03_04d) - points.body05 = points.body04.shift(body04_05a, body04_05d) - points.body06 = points.body05.shift(body05_06a, body05_06d) - points.body07 = points.body06.shift(body06_07a, body06_07d) - points.body08 = points.body07.shift(body07_08a, body07_08d) - points.body09 = points.body08.shift(body08_09a, body08_09d) - points.body10 = points.body09.shift(body09_10a, body09_10d) - points.body11 = points.body10.shift(body10_11a, body10_11d) - points.body12 = points.body11.shift(body11_12a, body11_12d) - points.body13 = points.body12.shift(body12_13a, body12_13d) - points.body14 = points.body13.shift(body13_14a, body13_14d) - points.body15 = points.body14.shift(body14_15a, body14_15d) - points.body16 = points.body15.shift(body15_16a, body15_16d) - points.body17 = points.body16.shift(body16_17a, body16_17d) - points.body18 = points.body17.shift(body17_18a, body17_18d) - points.body19 = points.body18.shift(body18_19a, body18_19d) + const eyeBigAngle = 184.8499937 + const eyeSmallAngle = 151.2656912 - points.body01cp1 = points.body01.shift(body01cp1a, body01cp1d) - points.body02cp1 = points.body02.shift(body02cp1a, body02cp1d) - points.body03cp1 = points.body03.shift(body03cp1a, body03cp1d) - points.body04cp1 = points.body04.shift(body04cp1a, body04cp1d) - points.body05cp1 = points.body05.shift(body05cp1a, body05cp1d) - points.body06cp1 = points.body06.shift(body06cp1a, body06cp1d) - points.body07cp1 = points.body07.shift(body07cp1a, body07cp1d) - points.body08cp1 = points.body08.shift(body08cp1a, body08cp1d) - points.body09cp1 = points.body09.shift(body09cp1a, body09cp1d) - points.body10cp1 = points.body10.shift(body10cp1a, body10cp1d) - points.body11cp1 = points.body11.shift(body11cp1a, body11cp1d) - points.body12cp1 = points.body12.shift(body12cp1a, body12cp1d) - points.body13cp1 = points.body13.shift(body13cp1a, body13cp1d) - points.body14cp1 = points.body14.shift(body14cp1a, body14cp1d) - points.body15cp1 = points.body15.shift(body15cp1a, body15cp1d) - points.body16cp1 = points.body16.shift(body16cp1a, body16cp1d) - points.body17cp1 = points.body17.shift(body17cp1a, body17cp1d) - points.body18cp1 = points.body18.shift(body18cp1a, body18cp1d) - points.body19cp1 = points.body19.shift(body19cp1a, body19cp1d) + const gillAngle = 103.9416747 - points.body01cp2 = points.body01.shift(body01cp2a, body01cp2d) - points.body02cp2 = points.body02.shift(body02cp2a, body02cp2d) - points.body03cp2 = points.body03.shift(body03cp2a, body03cp2d) - points.body04cp2 = points.body04.shift(body04cp2a, body04cp2d) - points.body05cp2 = points.body05.shift(body05cp2a, body05cp2d) - points.body06cp2 = points.body06.shift(body06cp2a, body06cp2d) - points.body07cp2 = points.body07.shift(body07cp2a, body07cp2d) - points.body08cp2 = points.body08.shift(body08cp2a, body08cp2d) - points.body09cp2 = points.body09.shift(body09cp2a, body09cp2d) - points.body10cp2 = points.body10.shift(body10cp2a, body10cp2d) - points.body11cp2 = points.body11.shift(body11cp2a, body11cp2d) - points.body12cp2 = points.body12.shift(body12cp2a, body12cp2d) - points.body13cp2 = points.body13.shift(body13cp2a, body13cp2d) - points.body14cp2 = points.body14.shift(body14cp2a, body14cp2d) - points.body15cp2 = points.body15.shift(body15cp2a, body15cp2d) - points.body16cp2 = points.body16.shift(body16cp2a, body16cp2d) - points.body17cp2 = points.body17.shift(body17cp2a, body17cp2d) - points.body18cp2 = points.body18.shift(body18cp2a, body18cp2d) - points.body19cp2 = points.body19.shift(body19cp2a, body19cp2d) + points.body01 = new Point(0, 0) + points.body02 = points.body01.shift(body01_02a, body01_02d) + points.body03 = points.body02.shift(body02_03a, body02_03d) + points.body04 = points.body03.shift(body03_04a, body03_04d) + points.body05 = points.body04.shift(body04_05a, body04_05d) + points.body06 = points.body05.shift(body05_06a, body05_06d) + points.body07 = points.body06.shift(body06_07a, body06_07d) + points.body08 = points.body07.shift(body07_08a, body07_08d) + points.body09 = points.body08.shift(body08_09a, body08_09d) + points.body10 = points.body09.shift(body09_10a, body09_10d) + points.body11 = points.body10.shift(body10_11a, body10_11d) + points.body12 = points.body11.shift(body11_12a, body11_12d) + points.body13 = points.body12.shift(body12_13a, body12_13d) + points.body14 = points.body13.shift(body13_14a, body13_14d) + points.body15 = points.body14.shift(body14_15a, body14_15d) + points.body16 = points.body15.shift(body15_16a, body15_16d) + points.body17 = points.body16.shift(body16_17a, body16_17d) + points.body18 = points.body17.shift(body17_18a, body17_18d) + points.body19 = points.body18.shift(body18_19a, body18_19d) - //Adjust dart point: - points.body02 = points.body01.shift(body01_02a - 1.7, body01_02d) + points.body01cp1 = points.body01.shift(body01cp1a, body01cp1d) + points.body02cp1 = points.body02.shift(body02cp1a, body02cp1d) + points.body03cp1 = points.body03.shift(body03cp1a, body03cp1d) + points.body04cp1 = points.body04.shift(body04cp1a, body04cp1d) + points.body05cp1 = points.body05.shift(body05cp1a, body05cp1d) + points.body06cp1 = points.body06.shift(body06cp1a, body06cp1d) + points.body07cp1 = points.body07.shift(body07cp1a, body07cp1d) + points.body08cp1 = points.body08.shift(body08cp1a, body08cp1d) + points.body09cp1 = points.body09.shift(body09cp1a, body09cp1d) + points.body10cp1 = points.body10.shift(body10cp1a, body10cp1d) + points.body11cp1 = points.body11.shift(body11cp1a, body11cp1d) + points.body12cp1 = points.body12.shift(body12cp1a, body12cp1d) + points.body13cp1 = points.body13.shift(body13cp1a, body13cp1d) + points.body14cp1 = points.body14.shift(body14cp1a, body14cp1d) + points.body15cp1 = points.body15.shift(body15cp1a, body15cp1d) + points.body16cp1 = points.body16.shift(body16cp1a, body16cp1d) + points.body17cp1 = points.body17.shift(body17cp1a, body17cp1d) + points.body18cp1 = points.body18.shift(body18cp1a, body18cp1d) + points.body19cp1 = points.body19.shift(body19cp1a, body19cp1d) - // Front dart adjustments: - points.body01cp2 = points.body01.shift( - points.body01.angle(points.body19) + - (points.body19.angle(points.body01) - points.body19.angle(points.body19cp1)), - body01cp2d - ) - body01cp1a = Math.min( - points.body01.angle(points.body01cp2) + 90 * (-1 + options.nosePointiness), - points.body01.angle(points.body02) - 5 - ) + points.body01cp2 = points.body01.shift(body01cp2a, body01cp2d) + points.body02cp2 = points.body02.shift(body02cp2a, body02cp2d) + points.body03cp2 = points.body03.shift(body03cp2a, body03cp2d) + points.body04cp2 = points.body04.shift(body04cp2a, body04cp2d) + points.body05cp2 = points.body05.shift(body05cp2a, body05cp2d) + points.body06cp2 = points.body06.shift(body06cp2a, body06cp2d) + points.body07cp2 = points.body07.shift(body07cp2a, body07cp2d) + points.body08cp2 = points.body08.shift(body08cp2a, body08cp2d) + points.body09cp2 = points.body09.shift(body09cp2a, body09cp2d) + points.body10cp2 = points.body10.shift(body10cp2a, body10cp2d) + points.body11cp2 = points.body11.shift(body11cp2a, body11cp2d) + points.body12cp2 = points.body12.shift(body12cp2a, body12cp2d) + points.body13cp2 = points.body13.shift(body13cp2a, body13cp2d) + points.body14cp2 = points.body14.shift(body14cp2a, body14cp2d) + points.body15cp2 = points.body15.shift(body15cp2a, body15cp2d) + points.body16cp2 = points.body16.shift(body16cp2a, body16cp2d) + points.body17cp2 = points.body17.shift(body17cp2a, body17cp2d) + points.body18cp2 = points.body18.shift(body18cp2a, body18cp2d) + points.body19cp2 = points.body19.shift(body19cp2a, body19cp2d) - points.body01cp1 = points.body01.shift(body01cp1a, body01cp1d) + // Adjust dart point: + points.body02 = points.body01.shift(body01_02a - 1.7, body01_02d) - // Make both sides of the dart equal: - points.body03 = points.body02.shift(body02_03a, body01_02d) + // Front dart adjustments: + points.body01cp2 = points.body01.shift( + points.body01.angle(points.body19) + + (points.body19.angle(points.body01) - points.body19.angle(points.body19cp1)), + body01cp2d + ) + body01cp1a = Math.min( + points.body01.angle(points.body01cp2) + 90 * (-1 + options.nosePointiness), + points.body01.angle(points.body02) - 5 + ) - points.body02cp1 = points.body02.shift( - points.body02.angle(points.body03) - - (points.body02.angle(points.body02cp2) - points.body02.angle(points.body01)), - body02cp2d - ) - points.body03cp2 = points.body03.shift( - points.body03.angle(points.body02) + - (points.body01.angle(points.body02) - points.body01.angle(points.body01cp1)), - body01cp1d - ) + points.body01cp1 = points.body01.shift(body01cp1a, body01cp1d) - // Nose adjustment: - points.body03cp1 = points.body03.shift( - body03cp1a + Math.max(-10, 50 * options.nosePointiness), - body03cp1d - ) + // Make both sides of the dart equal: + points.body03 = points.body02.shift(body02_03a, body01_02d) - // Tail adjustment: - let tailCpAngle = - (points.body13.angle(points.body13cp1) - - points.body13.angle(points.body14) + - (points.body14.angle(points.body13) - points.body14.angle(points.body14cp2))) / - 2 - points.body14cp2 = points.body14.shift( - points.body14.angle(points.body13) - tailCpAngle, - body13cp1d - ) - points.body13cp1 = points.body13.shift( - points.body13.angle(points.body14) + tailCpAngle, - body13cp1d - ) + points.body02cp1 = points.body02.shift( + points.body02.angle(points.body03) - + (points.body02.angle(points.body02cp2) - points.body02.angle(points.body01)), + body02cp2d + ) + points.body03cp2 = points.body03.shift( + points.body03.angle(points.body02) + + (points.body01.angle(points.body02) - points.body01.angle(points.body01cp1)), + body01cp1d + ) - points.eyeBig = points.body01.shift(eyeBigAngle, eyeBigDist) - points.eyeSmall = points.eyeBig.shift( - eyeSmallAngle, - eyeSmallDist * (-0.5 + (options.aggressive ? 0 : 1)) - ) + // Nose adjustment: + points.body03cp1 = points.body03.shift( + body03cp1a + Math.max(-10, 50 * options.nosePointiness), + body03cp1d + ) - const c = 0.55191502449351 - const eyeBigX = 18.7757 * options.size - const eyeBigY = 11.6262 * options.size - points.eyeBigT = points.eyeBig.shift(90, eyeBigY / 2) - points.eyeBigB = points.eyeBig - .shift(270, eyeBigY / 2) - .shift(0, options.aggressive ? eyeBigX / 3 : 0) - points.eyeBigR = points.eyeBig - .shift(0, eyeBigX / 2) - .shift(270, options.aggressive ? eyeBigY / 3 : 0) - points.eyeBigL = points.eyeBig.shift(180, eyeBigX / 2) - points.eyeBigTcp1 = points.eyeBigT.shift(0, (eyeBigY / 2) * c) - points.eyeBigTcp2 = points.eyeBigT.shift(180, (eyeBigY / 2) * c) - points.eyeBigBcp1 = points.eyeBigB.shift(180, (eyeBigY / 2) * c) - points.eyeBigBcp2 = points.eyeBigB.shift(0, (eyeBigY / 2) * c) - points.eyeBigRcp1 = points.eyeBigR.shift(270, (eyeBigX / (options.aggressive ? 3 : 2)) * c) - points.eyeBigRcp2 = points.eyeBigR.shift(90, (eyeBigX / 2) * c) - points.eyeBigLcp1 = points.eyeBigL.shift(90, (eyeBigX / 2) * c) - points.eyeBigLcp2 = points.eyeBigL.shift(270, (eyeBigX / 2) * c) + // Tail adjustment: + let tailCpAngle = + (points.body13.angle(points.body13cp1) - + points.body13.angle(points.body14) + + (points.body14.angle(points.body13) - points.body14.angle(points.body14cp2))) / + 2 + points.body14cp2 = points.body14.shift( + points.body14.angle(points.body13) - tailCpAngle, + body13cp1d + ) + points.body13cp1 = points.body13.shift( + points.body13.angle(points.body14) + tailCpAngle, + body13cp1d + ) - paths.eyeBig = new Path() - .move(points.eyeBigT) - .curve(points.eyeBigTcp2, points.eyeBigLcp1, points.eyeBigL) - .curve(points.eyeBigLcp2, points.eyeBigBcp1, points.eyeBigB) - .curve(points.eyeBigBcp2, points.eyeBigRcp1, points.eyeBigR) - .curve(points.eyeBigRcp2, points.eyeBigTcp1, points.eyeBigT) + points.eyeBig = points.body01.shift(eyeBigAngle, eyeBigDist) + points.eyeSmall = points.eyeBig.shift( + eyeSmallAngle, + eyeSmallDist * (-0.5 + (options.aggressive ? 0 : 1)) + ) - const eyeSmallX = 1.87089 * options.size * (options.aggressive ? 1.5 : 1) - const eyeSmallY = 1.5368 * options.size * (options.aggressive ? 1.5 : 1) - points.eyeSmallT = points.eyeSmall.shift(270, eyeSmallY / 2) - points.eyeSmallB = points.eyeSmall.shift(90, eyeSmallY / 2) - points.eyeSmallR = points.eyeSmall.shift(0, eyeSmallX / 2) - points.eyeSmallL = points.eyeSmall.shift(180, eyeSmallX / 2) - points.eyeSmallTcp1 = points.eyeSmallT.shift(0, (eyeSmallY / 2) * c) - points.eyeSmallTcp2 = points.eyeSmallT.shift(180, (eyeSmallY / 2) * c) - points.eyeSmallBcp1 = points.eyeSmallB.shift(180, (eyeSmallY / 2) * c) - points.eyeSmallBcp2 = points.eyeSmallB.shift(0, (eyeSmallY / 2) * c) - points.eyeSmallRcp1 = points.eyeSmallR.shift(270, (eyeSmallX / 2) * c) - points.eyeSmallRcp2 = points.eyeSmallR.shift(90, (eyeSmallX / 2) * c) - points.eyeSmallLcp1 = points.eyeSmallL.shift(90, (eyeSmallX / 2) * c) - points.eyeSmallLcp2 = points.eyeSmallL.shift(270, (eyeSmallX / 2) * c) + const c = 0.55191502449351 + const eyeBigX = 18.7757 * multiplier + const eyeBigY = 11.6262 * multiplier + points.eyeBigT = points.eyeBig.shift(90, eyeBigY / 2) + points.eyeBigB = points.eyeBig + .shift(270, eyeBigY / 2) + .shift(0, options.aggressive ? eyeBigX / 3 : 0) + points.eyeBigR = points.eyeBig + .shift(0, eyeBigX / 2) + .shift(270, options.aggressive ? eyeBigY / 3 : 0) + points.eyeBigL = points.eyeBig.shift(180, eyeBigX / 2) + points.eyeBigTcp1 = points.eyeBigT.shift(0, (eyeBigY / 2) * c) + points.eyeBigTcp2 = points.eyeBigT.shift(180, (eyeBigY / 2) * c) + points.eyeBigBcp1 = points.eyeBigB.shift(180, (eyeBigY / 2) * c) + points.eyeBigBcp2 = points.eyeBigB.shift(0, (eyeBigY / 2) * c) + points.eyeBigRcp1 = points.eyeBigR.shift(270, (eyeBigX / (options.aggressive ? 3 : 2)) * c) + points.eyeBigRcp2 = points.eyeBigR.shift(90, (eyeBigX / 2) * c) + points.eyeBigLcp1 = points.eyeBigL.shift(90, (eyeBigX / 2) * c) + points.eyeBigLcp2 = points.eyeBigL.shift(270, (eyeBigX / 2) * c) - paths.eyeSmall = new Path() - .move(points.eyeSmallT) - .curve(points.eyeSmallTcp2, points.eyeSmallLcp1, points.eyeSmallL) - .curve(points.eyeSmallLcp2, points.eyeSmallBcp1, points.eyeSmallB) - .curve(points.eyeSmallBcp2, points.eyeSmallRcp1, points.eyeSmallR) - .curve(points.eyeSmallRcp2, points.eyeSmallTcp1, points.eyeSmallT) + if (complete) + paths.eyeBig = new Path() + .move(points.eyeBigT) + .curve(points.eyeBigTcp2, points.eyeBigLcp1, points.eyeBigL) + .curve(points.eyeBigLcp2, points.eyeBigBcp1, points.eyeBigB) + .curve(points.eyeBigBcp2, points.eyeBigRcp1, points.eyeBigR) + .curve(points.eyeBigRcp2, points.eyeBigTcp1, points.eyeBigT) - paths.allButDart = new Path() - .move(points.body03) - .curve(points.body03cp1, points.body04cp2, points.body04) - .curve(points.body04cp1, points.body05cp2, points.body05) - .curve(points.body05cp1, points.body06cp2, points.body06) - .curve(points.body06cp1, points.body07cp2, points.body07) - .curve(points.body07cp1, points.body08cp2, points.body08) - .curve(points.body08cp1, points.body09cp2, points.body09) - .curve(points.body09cp1, points.body10cp2, points.body10) - .curve(points.body10cp1, points.body11cp2, points.body11) - .curve(points.body11cp1, points.body12cp2, points.body12) - .curve(points.body12cp1, points.body13cp2, points.body13) - .curve(points.body13cp1, points.body14cp2, points.body14) - .curve(points.body14cp1, points.body15cp2, points.body15) - .curve(points.body15cp1, points.body16cp2, points.body16) - .curve(points.body16cp1, points.body17cp2, points.body17) - .curve(points.body17cp1, points.body18cp2, points.body18) - .curve(points.body18cp1, points.body19cp2, points.body19) - .curve(points.body19cp1, points.body01cp2, points.body01) - .hide() + const eyeSmallX = 1.87089 * multiplier * (options.aggressive ? 1.5 : 1) + const eyeSmallY = 1.5368 * multiplier * (options.aggressive ? 1.5 : 1) + points.eyeSmallT = points.eyeSmall.shift(270, eyeSmallY / 2) + points.eyeSmallB = points.eyeSmall.shift(90, eyeSmallY / 2) + points.eyeSmallR = points.eyeSmall.shift(0, eyeSmallX / 2) + points.eyeSmallL = points.eyeSmall.shift(180, eyeSmallX / 2) + points.eyeSmallTcp1 = points.eyeSmallT.shift(0, (eyeSmallY / 2) * c) + points.eyeSmallTcp2 = points.eyeSmallT.shift(180, (eyeSmallY / 2) * c) + points.eyeSmallBcp1 = points.eyeSmallB.shift(180, (eyeSmallY / 2) * c) + points.eyeSmallBcp2 = points.eyeSmallB.shift(0, (eyeSmallY / 2) * c) + points.eyeSmallRcp1 = points.eyeSmallR.shift(270, (eyeSmallX / 2) * c) + points.eyeSmallRcp2 = points.eyeSmallR.shift(90, (eyeSmallX / 2) * c) + points.eyeSmallLcp1 = points.eyeSmallL.shift(90, (eyeSmallX / 2) * c) + points.eyeSmallLcp2 = points.eyeSmallL.shift(270, (eyeSmallX / 2) * c) - paths.seam = new Path() - .move(points.body01) - .curve(points.body01cp1, points.body02cp2, points.body02) - .curve(points.body02cp1, points.body03cp2, points.body03) - .join(paths.allButDart) - .close() + if (complete) + paths.eyeSmall = new Path() + .move(points.eyeSmallT) + .curve(points.eyeSmallTcp2, points.eyeSmallLcp1, points.eyeSmallL) + .curve(points.eyeSmallLcp2, points.eyeSmallBcp1, points.eyeSmallB) + .curve(points.eyeSmallBcp2, points.eyeSmallRcp1, points.eyeSmallR) + .curve(points.eyeSmallRcp2, points.eyeSmallTcp1, points.eyeSmallT) - const gillPath = new Path() - .move(points.body17) - .curve(points.body17cp1, points.body18cp2, points.body18) - points.gill1start = gillPath.shiftFractionAlong(0.018) - points.gill2start = gillPath.shiftFractionAlong(0.08 * 1 + 0.018) - points.gill3start = gillPath.shiftFractionAlong(0.08 * 2 + 0.018) - points.gill4start = gillPath.shiftFractionAlong(0.08 * 3 + 0.018) - points.gill5start = gillPath.shiftFractionAlong(0.08 * 4 + 0.018) - points.gill1end = points.gill1start.shift(gillAngle, gillLength * (1 + 0 * 0.08)) - points.gill2end = points.gill2start.shift(gillAngle, gillLength * (1 + 1 * 0.08)) - points.gill3end = points.gill3start.shift(gillAngle, gillLength * (1 + 2 * 0.08)) - points.gill4end = points.gill4start.shift(gillAngle, gillLength * (1 + 3 * 0.08)) - points.gill5end = points.gill5start.shift(gillAngle, gillLength * (1 + 4 * 0.08)) - - paths.gill1 = new Path().move(points.gill1start).line(points.gill1end) - paths.gill2 = new Path().move(points.gill2start).line(points.gill2end) - paths.gill3 = new Path().move(points.gill3start).line(points.gill3end) - paths.gill4 = new Path().move(points.gill4start).line(points.gill4end) - paths.gill5 = new Path().move(points.gill5start).line(points.gill5end) - - store.set('tailWidth', points.body13.dist(points.body14)) - store.set( - 'tailCpAngle', - points.body13.angle(points.body13cp1) - points.body13.angle(points.body14) - ) - store.set('tailCpDist', body13cp1d) - - store.set('topFinOpening', points.body16.dist(points.body17)) - store.set( - 'topFinOpeningLength', - new Path().move(points.body16).curve(points.body16cp1, points.body17cp2, points.body17).length() - ) - - store.set( - 'faceTopLength', - new Path() - .move(points.body17) + paths.allButDart = new Path() + .move(points.body03) + .curve(points.body03cp1, points.body04cp2, points.body04) + .curve(points.body04cp1, points.body05cp2, points.body05) + .curve(points.body05cp1, points.body06cp2, points.body06) + .curve(points.body06cp1, points.body07cp2, points.body07) + .curve(points.body07cp1, points.body08cp2, points.body08) + .curve(points.body08cp1, points.body09cp2, points.body09) + .curve(points.body09cp1, points.body10cp2, points.body10) + .curve(points.body10cp1, points.body11cp2, points.body11) + .curve(points.body11cp1, points.body12cp2, points.body12) + .curve(points.body12cp1, points.body13cp2, points.body13) + .curve(points.body13cp1, points.body14cp2, points.body14) + .curve(points.body14cp1, points.body15cp2, points.body15) + .curve(points.body15cp1, points.body16cp2, points.body16) + .curve(points.body16cp1, points.body17cp2, points.body17) .curve(points.body17cp1, points.body18cp2, points.body18) .curve(points.body18cp1, points.body19cp2, points.body19) - .length() - ) + .curve(points.body19cp1, points.body01cp2, points.body01) + .hide() - store.set( - 'bellyLength', - new Path() + paths.seam = new Path() + .move(points.body01) + .curve(points.body01cp1, points.body02cp2, points.body02) + .curve(points.body02cp1, points.body03cp2, points.body03) + .join(paths.allButDart) + .close() + + const gillPath = new Path() .move(points.body17) .curve(points.body17cp1, points.body18cp2, points.body18) - .curve(points.body18cp1, points.body19cp2, points.body19) - .length() - ) - store.set( - 'bellyTailLength', - new Path().move(points.body15).curve(points.body15cp1, points.body16cp2, points.body16).length() - ) + points.gill1start = gillPath.shiftFractionAlong(0.018) + points.gill2start = gillPath.shiftFractionAlong(0.08 * 1 + 0.018) + points.gill3start = gillPath.shiftFractionAlong(0.08 * 2 + 0.018) + points.gill4start = gillPath.shiftFractionAlong(0.08 * 3 + 0.018) + points.gill5start = gillPath.shiftFractionAlong(0.08 * 4 + 0.018) + points.gill1end = points.gill1start.shift(gillAngle, gillLength * (1 + 0 * 0.08)) + points.gill2end = points.gill2start.shift(gillAngle, gillLength * (1 + 1 * 0.08)) + points.gill3end = points.gill3start.shift(gillAngle, gillLength * (1 + 2 * 0.08)) + points.gill4end = points.gill4start.shift(gillAngle, gillLength * (1 + 3 * 0.08)) + points.gill5end = points.gill5start.shift(gillAngle, gillLength * (1 + 4 * 0.08)) - // Reduce precision as size goes up coz performance - store.set('tolerance', options.size < 1 ? 1 : options.size * 100) + if (complete) { + paths.gill1 = new Path().move(points.gill1start).line(points.gill1end) + paths.gill2 = new Path().move(points.gill2start).line(points.gill2end) + paths.gill3 = new Path().move(points.gill3start).line(points.gill3end) + paths.gill4 = new Path().move(points.gill4start).line(points.gill4end) + paths.gill5 = new Path().move(points.gill5start).line(points.gill5end) + } - points.grainlineFrom = points.body13.shiftFractionTowards(points.body03, 0.5) - macro('grainline', { - from: points.grainlineFrom, - to: points.body03, - }) + points.finCurve = utils.beamsIntersect( + points.body05, + points.body05cp2, + points.body04, + points.body04cp1 + ) - store.cutlist.addCut({ material: 'color1UpperBody' }) + store.set('tailWidth', points.body13.dist(points.body14)) + store.set( + 'tailCpAngle', + points.body13.angle(points.body13cp1) - points.body13.angle(points.body14) + ) + store.set('tailCpDist', body13cp1d) + + store.set('topOfFinOpening', points.body16.dist(points.body17)) + store.set( + 'topOfFinOpeningLength', + new Path() + .move(points.body16) + .curve(points.body16cp1, points.body17cp2, points.body17) + .length() + ) + + store.set( + 'faceTopLength', + new Path() + .move(points.body17) + .curve(points.body17cp1, points.body18cp2, points.body18) + .curve(points.body18cp1, points.body19cp2, points.body19) + .length() + ) + + store.set( + 'bellyLength', + new Path() + .move(points.body17) + .curve(points.body17cp1, points.body18cp2, points.body18) + .curve(points.body18cp1, points.body19cp2, points.body19) + .length() + ) + store.set( + 'bellyTailLength', + new Path() + .move(points.body15) + .curve(points.body15cp1, points.body16cp2, points.body16) + .length() + ) + + // Reduce precision as size goes up coz performance + store.set('tolerance', multiplier < 1 ? 1 : multiplier * 100) + + points.grainlineFrom = points.body13.shiftFractionTowards(points.body03, 0.5) + macro('grainline', { + from: points.grainlineFrom, + to: points.body03, + }) + + store.cutlist.addCut({ cut: 2, material: 'color1UpperBody' }) - // Complete? - if (complete) { points.bodyTailSnippet = new Path() .move(points.body13) .curve(points.body13cp1, points.body14cp2, points.body14) .shiftFractionAlong(0.25) snippets.bodyTail = new Snippet('bnotch', points.bodyTailSnippet) - if (sa) { - // paths.sa = paths.seam.offset(sa).trim().attr('class', 'fabric sa') - paths.sa = paths.allButDart.close().offset(sa).attr('class', 'fabric sa') - } paths.aboveMouth = new Path() .move(points.body17) @@ -420,6 +453,7 @@ function draftHiBody({ macro('banner', { path: paths.aboveMouth, text: 'aboveMouth', + id: 'aboveMouth', dy: 0, spaces: 0, repeat: 1, @@ -431,18 +465,20 @@ function draftHiBody({ macro('banner', { path: paths.belly, text: 'belly', + id: 'belly', dy: 0, spaces: 10, repeat: 3, }) - paths.topFin = new Path() + paths.topOfFin = new Path() .move(points.body16) .curve(points.body16cp1, points.body17cp2, points.body17) .attr('class', 'hidden') .attr('data-text-class', 'text-xs') macro('banner', { - path: paths.topFin, - text: 'topFin', + path: paths.topOfFin, + text: 'topOfFin', + id: 'topOfFin', dy: 0, spaces: 10, repeat: 3, @@ -455,6 +491,7 @@ function draftHiBody({ macro('banner', { path: paths.tail, text: 'tail', + id: 'tail', dy: 0, spaces: 14, repeat: 3, @@ -464,201 +501,217 @@ function draftHiBody({ from: points.body13, to: points.body01, d: -5, + id: 'bodyLength', + force: complete, }) points.titleAnchor = points.body04.shiftFractionTowards(points.body17, 0.4) points.logoAnchor = points.body06.shiftFractionTowards(points.body16, 0.6) + points.gridAnchor = points.logoAnchor.clone() - if (options.size < 0.35) { + if (multiplier < 0.35) { points.scaleboxAnchor = new Point(points.body06.x - 60 - sa, points.body11.y - 35 - sa) } else { points.scaleboxAnchor = points.titleAnchor.shiftFractionTowards(points.body14, 0.5) } snippets.logo = new Snippet('logo', points.logoAnchor).attr( 'data-scale', - options.size > 1 ? 1 : options.size + multiplier > 1 ? 1 : multiplier ) macro('title', { at: points.titleAnchor, nr: 1, title: 'body', - scale: options.size, + scale: multiplier, }) - if (paperless) { - macro('hd', { - from: points.body14, - to: points.body15, - y: points.body19.y + sa + 10, - }) - macro('hd', { - from: points.body15, - to: points.body16, - y: points.body19.y + sa + 10, - }) - macro('hd', { - from: points.body16, - to: points.body17, - y: points.body19.y + sa + 10, - }) - macro('hd', { - from: points.body17, - to: points.body19, - y: points.body19.y + sa + 10, - }) - macro('hd', { - from: points.body19, - to: points.body01, - y: points.body19.y + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('hd', { - from: points.gill1start, + macro('hd', { + from: points.body14, + to: points.body15, + y: points.body19.y + sa + 10, + id: 'tailToBody', + }) + macro('hd', { + from: points.body15, + to: points.body16, + y: points.body19.y + sa + 10, + id: 'bodyWidth', + }) + macro('hd', { + from: points.body16, + to: points.body17, + y: points.body19.y + sa + 10, + id: 'finWidth', + }) + macro('hd', { + from: points.body17, + to: points.body19, + y: points.body19.y + sa + 10, + id: 'finToMiddle', + }) + macro('hd', { + from: points.body19, + to: points.body01, + y: points.body19.y + sa + 10, + noStartMarker: true, + noEndMarker: true, + id: 'middleToTip', + }) + macro('hd', { + from: points.gill1start, + to: points.gill5start, + y: points.body19.y + sa + 20, + id: 'gillWidth', + }) + macro('hd', { + from: points.eyeBig, + to: points.body19, + y: points.body19.y + sa + 20, + id: 'eyeToMiddle', + }) + macro('hd', { + from: points.eyeBigL, + to: points.eyeBigR, + y: points.eyeBigT.y - 10, + id: 'eyeWidth', + noStartMarker: true, + noEndMarker: true, + }) + macro('hd', { + from: points.body14, + to: points.body13, + y: points.body06.y - sa - 5, + id: 'tailWidth', + }) + macro('hd', { + from: points.body13, + to: points.body10, + y: points.body06.y - sa - 5, + id: 'tailTo1stFin', + }) + macro('hd', { + from: points.body10, + to: points.body06, + y: points.body06.y - sa - 5, + id: '1stFinTo2ndFin', + }) + macro('hd', { + from: points.body06, + to: points.finCurve, + y: points.body06.y - sa - 5, + id: '2ndFinToBody', + }) + macro('hd', { + from: points.finCurve, + to: points.body03, + y: points.body06.y - sa - 5, + id: '2ndFinToTip', + }) + macro('hd', { + from: points.body03, + to: points.body01, + y: points.body06.y - sa - 5, + id: 'tipToMiddle', + noStartMarker: true, + noEndMarker: true, + }) + macro('hd', { + from: points.body02, + to: points.body03, + y: points.body06.y - sa + 10, + id: 'topDartDepth', + }) + macro('hd', { + from: points.body02, + to: points.body01, + y: points.body06.y - sa + 20, + id: 'bottomDartDepth', + }) + + macro('vd', { + from: points.body19, + to: points.body14, + x: points.body14.x - sa - 10, + id: 'heightTail', + }) + macro('vd', { + from: points.body15, + to: points.body14, + x: points.body14.x - sa - 20, + id: 'bodyToTail', + }) + macro('vd', { + from: points.body14, + to: points.body13, + x: points.body14.x - sa - 20, + id: 'tailHeight', + }) + macro('vd', { + from: points.body14, + to: points.body10, + x: points.body14.x - sa - 30, + id: 'tailTo1stFin', + }) + macro('vd', { + from: points.body14, + to: points.body08, + x: points.body14.x - sa - 10, + id: 'tailToBetweenFins', + }) + macro('vd', { + from: points.body10, + to: points.body06, + x: points.body14.x - sa - 30, + id: 'heightFinToFin', + }) + macro('vd', { + from: points.body01, + to: points.body19, + x: points.body01.x + sa + 10, + id: 'middleToDart', + }) + macro('vd', { + from: points.body02, + to: points.body19, + x: points.body01.x + sa + 20, + id: 'middleToBackOfDart', + }) + macro('vd', { + from: points.body03, + to: points.body01, + x: points.body01.x + sa + 10, + id: 'dartToDart', + }) + macro('vd', { + from: points.finCurve, + to: points.body02, + x: points.body01.x + sa + 20, + id: 'dartToFinCurve', + }) + macro('vd', { + from: points.body06, + to: points.finCurve, + x: points.body01.x + sa + 20, + id: 'finCurveToFin', + }) + if (multiplier > 0.4) { + macro('vd', { + from: points.gill5end, to: points.gill5start, - y: points.body19.y + sa + 20, - }) - macro('hd', { - from: points.eyeBig, - to: points.body19, - y: points.body19.y + sa + 20, - }) - macro('hd', { - from: points.eyeBigL, - to: points.eyeBigR, - y: points.eyeBigT.y - 10, + x: points.gill5start.x + 5, + id: 'gillHeight', noStartMarker: true, noEndMarker: true, }) - - macro('hd', { - from: points.body14, - to: points.body13, - y: points.body06.y - sa - 5, - }) - macro('hd', { - from: points.body13, - to: points.body10, - y: points.body06.y - sa - 5, - }) - macro('hd', { - from: points.body10, - to: points.body06, - y: points.body06.y - sa - 5, - }) - points.finCurve = utils.beamsIntersect( - points.body05, - points.body05cp2, - points.body04, - points.body04cp1 - ) - macro('hd', { - from: points.body06, - to: points.finCurve, - y: points.body06.y - sa - 5, - }) - macro('hd', { - from: points.finCurve, - to: points.body03, - y: points.body06.y - sa - 5, - }) - macro('hd', { - from: points.body03, - to: points.body01, - y: points.body06.y - sa - 5, - noStartMarker: true, - noEndMarker: true, - }) - macro('hd', { - from: points.body02, - to: points.body03, - y: points.body06.y - sa + 10, - }) - macro('hd', { - from: points.body02, - to: points.body01, - y: points.body06.y - sa + 20, - }) - - macro('vd', { - from: points.body19, - to: points.body14, - x: points.body14.x - sa - 10, - }) - macro('vd', { - from: points.body15, - to: points.body14, - x: points.body14.x - sa - 20, - }) - macro('vd', { - from: points.body14, - to: points.body13, - x: points.body14.x - sa - 20, - }) - macro('vd', { - from: points.body14, - to: points.body10, - x: points.body14.x - sa - 30, - }) - macro('vd', { - from: points.body14, - to: points.body08, - x: points.body14.x - sa - 10, - }) - macro('vd', { - from: points.body10, - to: points.body06, - x: points.body14.x - sa - 30, - }) - macro('vd', { - from: points.body01, - to: points.body19, - x: points.body01.x + sa + 10, - }) - macro('vd', { - from: points.body02, - to: points.body19, - x: points.body01.x + sa + 20, - }) - macro('vd', { - from: points.body03, - to: points.body01, - x: points.body01.x + sa + 10, - }) - macro('vd', { - from: points.finCurve, - to: points.body02, - x: points.body01.x + sa + 20, - }) - macro('vd', { - from: points.body06, - to: points.finCurve, - x: points.body01.x + sa + 20, - }) - if (options.size > 0.4) { - macro('vd', { - from: points.gill5end, - to: points.gill5start, - x: points.gill5start.x + 5, - noStartMarker: true, - noEndMarker: true, - }) - } - } else { - macro('scalebox', { at: points.scaleboxAnchor }) } - } - return part -} + macro('scalebox', { at: points.scaleboxAnchor }) -export const body = { - name: 'hi.body', - options: { - size: { pct: 100, min: 5, max: 500, menu: 'style' }, - nosePointiness: { pct: 0, min: -5, max: +10, menu: 'style' }, - aggressive: { bool: false, menu: 'style' }, + if (sa) { + paths.sa = paths.allButDart.close().offset(sa).attr('class', 'fabric sa') + } + + return part }, - draft: draftHiBody, } diff --git a/designs/hi/src/bottomFin.mjs b/designs/hi/src/bottomFin.mjs index a91d4ba91e5..274ef9456eb 100644 --- a/designs/hi/src/bottomFin.mjs +++ b/designs/hi/src/bottomFin.mjs @@ -2,110 +2,99 @@ import { body } from './body.mjs' import { belly } from './belly.mjs' import { aboveMouth } from './aboveMouth.mjs' -function draftHiBottomFin({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - let bottomFin01_02d = 250.63638754690027 * options.size - const bottomFin01_02a = 119.34849371430543 - let bottomFin01_03d = 137.70322741678933 * options.size - const bottomFin01_03a = 175.11970494988498 - const bottomFin01cp1d = 133.21819413653674 * options.size - const bottomFin01cp2d = 51.94197687805115 * options.size - const bottomFin01cp1a = 95.20910872095476 - const bottomFin01cp2a = 158.66090918215986 - const bottomFin02cp1d = 29.25974733588791 * options.size - const bottomFin02cp2d = 31.28292571739416 * options.size - const bottomFin02cp1a = 208.55316756249104 - const bottomFin02cp2a = 28.113642612639804 - const bottomFin03cp1d = 53.31550082293142 * options.size - const bottomFin03cp2d = 177.65809391356197 * options.size - const bottomFin03cp1a = 9.79694130335566 - const bottomFin03cp2a = 80.81868300891519 +export const bottomOfFin = { + name: 'hi.bottomOfFin', + after: [body, belly, aboveMouth], + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') - const finLength = store.get('aboveMouthFinLength') + store.get('bellyFinLength') - const finCircumference = store.get('topFinCircumference') + let bottomOfFin01_02d = 250.63638754690027 * multiplier + const bottomOfFin01_02a = 119.34849371430543 + let bottomOfFin01_03d = 137.70322741678933 * multiplier + const bottomOfFin01_03a = 175.11970494988498 + const bottomOfFin01cp1d = 133.21819413653674 * multiplier + const bottomOfFin01cp2d = 51.94197687805115 * multiplier + const bottomOfFin01cp1a = 95.20910872095476 + const bottomOfFin01cp2a = 158.66090918215986 + const bottomOfFin02cp1d = 29.25974733588791 * multiplier + const bottomOfFin02cp2d = 31.28292571739416 * multiplier + const bottomOfFin02cp1a = 208.55316756249104 + const bottomOfFin02cp2a = 28.113642612639804 + const bottomOfFin03cp1d = 53.31550082293142 * multiplier + const bottomOfFin03cp2d = 177.65809391356197 * multiplier + const bottomOfFin03cp1a = 9.79694130335566 + const bottomOfFin03cp2a = 80.81868300891519 - let diff = 0 - let iteration = 0 - do { - points.bottomFin01 = new Point(0, 0) - points.bottomFin02 = points.bottomFin01.shift(bottomFin01_02a, bottomFin01_02d) - points.bottomFin03 = points.bottomFin01.shift(bottomFin01_03a, bottomFin01_03d) + const finLength = store.get('aboveMouthFinLength') + store.get('bellyFinLength') + const finCircumference = store.get('topFinCircumference') - points.bottomFin01cp1 = points.bottomFin01.shift(bottomFin01cp1a, bottomFin01cp1d) - points.bottomFin01cp2 = points.bottomFin01.shift(bottomFin01cp2a, bottomFin01cp2d) - points.bottomFin02cp1 = points.bottomFin02.shift(bottomFin02cp1a, bottomFin02cp1d) - points.bottomFin02cp2 = points.bottomFin02.shift(bottomFin02cp2a, bottomFin02cp2d) - points.bottomFin03cp1 = points.bottomFin03.shift(bottomFin03cp1a, bottomFin03cp1d) - points.bottomFin03cp2 = points.bottomFin03.shift(bottomFin03cp2a, bottomFin03cp2d) + let diff = 0 + let iteration = 0 + do { + points.bottomOfFin01 = new Point(0, 0) + points.bottomOfFin02 = points.bottomOfFin01.shift(bottomOfFin01_02a, bottomOfFin01_02d) + points.bottomOfFin03 = points.bottomOfFin01.shift(bottomOfFin01_03a, bottomOfFin01_03d) - diff = - finLength - - new Path() - .move(points.bottomFin03) - .curve(points.bottomFin03cp1, points.bottomFin01cp2, points.bottomFin01) - .length() + points.bottomOfFin01cp1 = points.bottomOfFin01.shift(bottomOfFin01cp1a, bottomOfFin01cp1d) + points.bottomOfFin01cp2 = points.bottomOfFin01.shift(bottomOfFin01cp2a, bottomOfFin01cp2d) + points.bottomOfFin02cp1 = points.bottomOfFin02.shift(bottomOfFin02cp1a, bottomOfFin02cp1d) + points.bottomOfFin02cp2 = points.bottomOfFin02.shift(bottomOfFin02cp2a, bottomOfFin02cp2d) + points.bottomOfFin03cp1 = points.bottomOfFin03.shift(bottomOfFin03cp1a, bottomOfFin03cp1d) + points.bottomOfFin03cp2 = points.bottomOfFin03.shift(bottomOfFin03cp2a, bottomOfFin03cp2d) - bottomFin01_03d = bottomFin01_03d + diff - iteration++ - } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + diff = + finLength - + new Path() + .move(points.bottomOfFin03) + .curve(points.bottomOfFin03cp1, points.bottomOfFin01cp2, points.bottomOfFin01) + .length() - diff = 0 - iteration = 0 - do { - points.bottomFin01 = new Point(0, 0) - points.bottomFin02 = points.bottomFin01.shift(bottomFin01_02a, bottomFin01_02d) - points.bottomFin03 = points.bottomFin01.shift(bottomFin01_03a, bottomFin01_03d) + bottomOfFin01_03d = bottomOfFin01_03d + diff + iteration++ + } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) - points.bottomFin01cp1 = points.bottomFin01.shift(bottomFin01cp1a, bottomFin01cp1d) - points.bottomFin01cp2 = points.bottomFin01.shift(bottomFin01cp2a, bottomFin01cp2d) - points.bottomFin02cp1 = points.bottomFin02.shift(bottomFin02cp1a, bottomFin02cp1d) - points.bottomFin02cp2 = points.bottomFin02.shift(bottomFin02cp2a, bottomFin02cp2d) - points.bottomFin03cp1 = points.bottomFin03.shift(bottomFin03cp1a, bottomFin03cp1d) - points.bottomFin03cp2 = points.bottomFin03.shift(bottomFin03cp2a, bottomFin03cp2d) + diff = 0 + iteration = 0 + do { + points.bottomOfFin01 = new Point(0, 0) + points.bottomOfFin02 = points.bottomOfFin01.shift(bottomOfFin01_02a, bottomOfFin01_02d) + points.bottomOfFin03 = points.bottomOfFin01.shift(bottomOfFin01_03a, bottomOfFin01_03d) - diff = - finCircumference - - new Path() - .move(points.bottomFin01) - .curve(points.bottomFin01cp1, points.bottomFin02cp2, points.bottomFin02) - .curve(points.bottomFin02cp1, points.bottomFin03cp2, points.bottomFin03) - .length() + points.bottomOfFin01cp1 = points.bottomOfFin01.shift(bottomOfFin01cp1a, bottomOfFin01cp1d) + points.bottomOfFin01cp2 = points.bottomOfFin01.shift(bottomOfFin01cp2a, bottomOfFin01cp2d) + points.bottomOfFin02cp1 = points.bottomOfFin02.shift(bottomOfFin02cp1a, bottomOfFin02cp1d) + points.bottomOfFin02cp2 = points.bottomOfFin02.shift(bottomOfFin02cp2a, bottomOfFin02cp2d) + points.bottomOfFin03cp1 = points.bottomOfFin03.shift(bottomOfFin03cp1a, bottomOfFin03cp1d) + points.bottomOfFin03cp2 = points.bottomOfFin03.shift(bottomOfFin03cp2a, bottomOfFin03cp2d) - bottomFin01_02d = bottomFin01_02d + diff - iteration++ - } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + diff = + finCircumference - + new Path() + .move(points.bottomOfFin01) + .curve(points.bottomOfFin01cp1, points.bottomOfFin02cp2, points.bottomOfFin02) + .curve(points.bottomOfFin02cp1, points.bottomOfFin03cp2, points.bottomOfFin03) + .length() - paths.seam = new Path() - .move(points.bottomFin01) - .curve(points.bottomFin01cp1, points.bottomFin02cp2, points.bottomFin02) - .curve(points.bottomFin02cp1, points.bottomFin03cp2, points.bottomFin03) - .curve(points.bottomFin03cp1, points.bottomFin01cp2, points.bottomFin01) - .close() + bottomOfFin01_02d = bottomOfFin01_02d + diff + iteration++ + } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) - store.cutlist.addCut({ material: 'color1UpperBody' }) + paths.seam = new Path() + .move(points.bottomOfFin01) + .curve(points.bottomOfFin01cp1, points.bottomOfFin02cp2, points.bottomOfFin02) + .curve(points.bottomOfFin02cp1, points.bottomOfFin03cp2, points.bottomOfFin03) + .curve(points.bottomOfFin03cp1, points.bottomOfFin01cp2, points.bottomOfFin01) + .close() + + store.cutlist.addCut({ cut: 2, material: 'color1UpperBody' }) - // Complete? - if (complete) { const finAttachment = new Path() - .move(points.bottomFin01) - .curve(points.bottomFin01cp2, points.bottomFin03cp1, points.bottomFin03) - points.bottomFinSnippet = finAttachment.shiftAlong(store.get('aboveMouthFinLength')) - snippets.bottomFin = new Snippet('bnotch', points.bottomFinSnippet) + .move(points.bottomOfFin01) + .curve(points.bottomOfFin01cp2, points.bottomOfFin03cp1, points.bottomOfFin03) + points.bottomOfFinSnippet = finAttachment.shiftAlong(store.get('aboveMouthFinLength')) + snippets.bottomOfFin = new Snippet('bnotch', points.bottomOfFinSnippet) - const attachments = finAttachment.split(points.bottomFinSnippet) + const attachments = finAttachment.split(points.bottomOfFinSnippet) paths.finAttachmentAboveMouth = attachments[0].reverse().attr('data-text-class', 'text-xs') paths.finAttachmentBelly = attachments[1].reverse().attr('data-text-class', 'text-xs') macro('banner', { @@ -114,6 +103,7 @@ function draftHiBottomFin({ dy: 0, spaces: 0, repeat: 4, + id: 'plusses', }) macro('banner', { path: paths.finAttachmentBelly, @@ -121,98 +111,90 @@ function draftHiBottomFin({ dy: 0, spaces: 4, repeat: 7, + id: 'circles', }) - points.titleAnchor = points.bottomFin02 - .shiftFractionTowards(points.bottomFin01, 0.4) - .shiftFractionTowards(points.bottomFin03, 0.1) - points.logoAnchor = points.titleAnchor.shiftFractionTowards(points.bottomFin03, 0.4) + points.titleAnchor = points.bottomOfFin02 + .shiftFractionTowards(points.bottomOfFin01, 0.4) + .shiftFractionTowards(points.bottomOfFin03, 0.1) + points.logoAnchor = points.titleAnchor.shiftFractionTowards(points.bottomOfFin03, 0.4) + points.gridAnchor = points.titleAnchor.clone() snippets.logo = new Snippet('logo', points.logoAnchor).attr( 'data-scale', - (options.size > 1 ? 1 : options.size) / 2 + (multiplier > 1 ? 1 : multiplier) / 2 ) macro('title', { at: points.titleAnchor, nr: 6, - title: 'bottomFin', - scale: (options.size > 1 ? 1 : options.size) / 2, + title: 'bottomOfFin', + scale: (multiplier > 1 ? 1 : multiplier) / 2, }) - if (paperless) { - points.bottomFinTop = paths.seam.edge('top') - let tempPath = new Path() - .move(points.bottomFin03) - .curve(points.bottomFin03cp2, points.bottomFin02cp1, points.bottomFin02) - const tempPoint = tempPath.shiftFractionAlong(0.8) - points.bottomFinInsideLeft = tempPath.split(tempPoint)[0].edge('right') - tempPath = new Path() - .move(points.bottomFin01) - .curve(points.bottomFin01cp2, points.bottomFin03cp1, points.bottomFin03) - points.bottomFinInsideBottom = tempPath.edge('top') + points.bottomOfFinTop = paths.seam.edge('top') + let tempPath = new Path() + .move(points.bottomOfFin03) + .curve(points.bottomOfFin03cp2, points.bottomOfFin02cp1, points.bottomOfFin02) + const tempPoint = tempPath.shiftFractionAlong(0.8) + points.bottomOfFinInsideLeft = tempPath.split(tempPoint)[0].edge('right') + tempPath = new Path() + .move(points.bottomOfFin01) + .curve(points.bottomOfFin01cp2, points.bottomOfFin03cp1, points.bottomOfFin03) + points.bottomOfFinInsideBottom = tempPath.edge('top') - macro('hd', { - from: points.bottomFin03, - to: points.bottomFin01, - y: points.bottomFin01.y + sa + 20, - }) - macro('hd', { - from: points.bottomFinTop, - to: points.bottomFin01, - y: points.bottomFinTop.y - sa - 10, - // id: 'smallTop', - // noStartMarker: true, - // noEndMarker: true, - }) - macro('hd', { - from: points.bottomFinInsideLeft, - to: points.bottomFin01, - y: points.bottomFin03.y + sa + 20, - // id: 'smallBottom', - // noStartMarker: true, - // noEndMarker: true, - }) - macro('hd', { - from: points.bottomFin03, - to: points.bottomFinSnippet, - y: points.bottomFin03.y + sa + 10, - }) - macro('vd', { - from: points.bottomFin03, - to: points.bottomFinTop, - x: points.bottomFin03.x - sa - 10, - }) - macro('vd', { - from: points.bottomFinTop, - to: points.bottomFin01, - x: points.bottomFin01.x + sa + 20, - }) - macro('vd', { - from: points.bottomFinTop, - to: points.bottomFinInsideBottom, - x: points.bottomFin01.x + sa + 10, - // id: 'smallRight', - // noStartMarker: true, - // noEndMarker: true, - }) - // if( options.size < 1.5 ) { - // paths.smallTop.attr('data-text-class', 'text-xs') - // paths.smallBottom.attr('data-text-class', 'text-xs') - // paths.smallRight.attr('data-text-class', 'text-xs') - // } - } + macro('hd', { + from: points.bottomOfFin03, + to: points.bottomOfFin01, + y: points.bottomOfFin01.y + sa + 20, + id: 'width', + }) + macro('hd', { + from: points.bottomOfFinTop, + to: points.bottomOfFin01, + y: points.bottomOfFinTop.y - sa - 10, + id: 'smallTop', + }) + macro('hd', { + from: points.bottomOfFinInsideLeft, + to: points.bottomOfFin01, + y: points.bottomOfFin03.y + sa + 20, + id: 'widthToSmallest', + }) + macro('hd', { + from: points.bottomOfFin03, + to: points.bottomOfFinSnippet, + y: points.bottomOfFin03.y + sa + 10, + id: 'widthToSnippet', + }) + macro('vd', { + from: points.bottomOfFin03, + to: points.bottomOfFinTop, + x: points.bottomOfFin03.x - sa - 10, + id: 'heightLeft', + }) + macro('vd', { + from: points.bottomOfFinTop, + to: points.bottomOfFin01, + x: points.bottomOfFin01.x + sa + 20, + id: 'heightRight', + }) + macro('vd', { + from: points.bottomOfFinTop, + to: points.bottomOfFinInsideBottom, + x: points.bottomOfFin01.x + sa + 10, + id: 'heightToSmallest', + }) + // if( multiplier < 1.5 ) { + // paths.smallTop.attr('data-text-class', 'text-xs') + // paths.smallBottom.attr('data-text-class', 'text-xs') + // paths.smallRight.attr('data-text-class', 'text-xs') + // } if (sa) { paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') } - } - return part -} - -export const bottomFin = { - name: 'hi.bottomFin', - after: [body, belly, aboveMouth], - draft: draftHiBottomFin, + return part + }, } diff --git a/designs/hi/src/index.mjs b/designs/hi/src/index.mjs index 3e933826257..9dd53d8fd20 100644 --- a/designs/hi/src/index.mjs +++ b/designs/hi/src/index.mjs @@ -7,16 +7,28 @@ import { tail } from './tail.mjs' import { mouth } from './mouth.mjs' import { aboveMouth } from './aboveMouth.mjs' import { belly } from './belly.mjs' -import { topFin } from './topFin.mjs' -import { bottomFin } from './bottomFin.mjs' +import { topOfFin } from './topFin.mjs' +import { bottomOfFin } from './bottomFin.mjs' import { lowerTeeth } from './lowerTeeth.mjs' import { upperTeeth } from './upperTeeth.mjs' // Create design const Hi = new Design({ data, - parts: [body, tail, mouth, aboveMouth, belly, topFin, bottomFin, lowerTeeth, upperTeeth], + parts: [body, tail, mouth, aboveMouth, belly, topOfFin, bottomOfFin, lowerTeeth, upperTeeth], }) // Named exports -export { body, tail, mouth, aboveMouth, belly, topFin, bottomFin, lowerTeeth, upperTeeth, Hi, i18n } +export { + body, + tail, + mouth, + aboveMouth, + belly, + topOfFin, + bottomOfFin, + lowerTeeth, + upperTeeth, + Hi, + i18n, +} diff --git a/designs/hi/src/lowerTeeth.mjs b/designs/hi/src/lowerTeeth.mjs index 231273c67c0..cb6b55697a3 100644 --- a/designs/hi/src/lowerTeeth.mjs +++ b/designs/hi/src/lowerTeeth.mjs @@ -1,68 +1,59 @@ +import { body } from './body.mjs' import { createTeeth } from './teeth.mjs' -function draftHiLowerTeeth({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - const lowerTeeth01_02d = 75.74338717643937 * options.size - const lowerTeeth01_02a = 25.414236606099728 + 180 - const lowerTeeth02cp1d = 47.74891452755759 * options.size - const lowerTeeth02cp1a = 42.59332849750379 - const lowerTeeth01cp2d = 27.774046078481962 * options.size - const lowerTeeth01cp2a = 180 +export const lowerTeeth = { + name: 'hi.lowerTeeth', + after: body, + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') - points.lowerTeeth01 = new Point(0, 0) - points.lowerTeeth02 = points.lowerTeeth01.shift(lowerTeeth01_02a, lowerTeeth01_02d) - points.lowerTeeth01cp2 = points.lowerTeeth01.shift(lowerTeeth01cp2a, lowerTeeth01cp2d) - points.lowerTeeth02cp1 = points.lowerTeeth02.shift(lowerTeeth02cp1a, lowerTeeth02cp1d) - // Make seam symmetric to optimize generating teeth - points.lowerTeeth02cp1 = points.lowerTeeth02.shiftTowards( - points.lowerTeeth02cp1, - points.lowerTeeth01cp2.dist(points.lowerTeeth01) - ) - points.lowerTeeth03 = points.lowerTeeth02.flipX() - points.lowerTeeth01cp1 = points.lowerTeeth01cp2.flipX() - points.lowerTeeth03cp2 = points.lowerTeeth02cp1.flipX() + const lowerTeeth01_02d = 75.74338717643937 * multiplier + const lowerTeeth01_02a = 25.414236606099728 + 180 + const lowerTeeth02cp1d = 47.74891452755759 * multiplier + const lowerTeeth02cp1a = 42.59332849750379 + const lowerTeeth01cp2d = 27.774046078481962 * multiplier + const lowerTeeth01cp2a = 180 - paths.seam = new Path() - .move(points.lowerTeeth02) - .curve(points.lowerTeeth02cp1, points.lowerTeeth01cp2, points.lowerTeeth01) - .curve(points.lowerTeeth01cp1, points.lowerTeeth03cp2, points.lowerTeeth03) + points.lowerTeeth01 = new Point(0, 0) + points.lowerTeeth02 = points.lowerTeeth01.shift(lowerTeeth01_02a, lowerTeeth01_02d) + points.lowerTeeth01cp2 = points.lowerTeeth01.shift(lowerTeeth01cp2a, lowerTeeth01cp2d) + points.lowerTeeth02cp1 = points.lowerTeeth02.shift(lowerTeeth02cp1a, lowerTeeth02cp1d) + // Make seam symmetric to optimize generating teeth + points.lowerTeeth02cp1 = points.lowerTeeth02.shiftTowards( + points.lowerTeeth02cp1, + points.lowerTeeth01cp2.dist(points.lowerTeeth01) + ) + points.lowerTeeth03 = points.lowerTeeth02.flipX() + points.lowerTeeth01cp1 = points.lowerTeeth01cp2.flipX() + points.lowerTeeth03cp2 = points.lowerTeeth02cp1.flipX() - store.set('lowerTeethLength', paths.seam.length()) + paths.seam = new Path() + .move(points.lowerTeeth02) + .curve(points.lowerTeeth02cp1, points.lowerTeeth01cp2, points.lowerTeeth01) + .curve(points.lowerTeeth01cp1, points.lowerTeeth03cp2, points.lowerTeeth03) - paths.teeth = createTeeth( - [ - // Array holding the points for half a mouth (bezier, not path) - points.lowerTeeth02, // start - points.lowerTeeth02cp1, // cp1 - points.lowerTeeth01cp2, // cp2 - points.lowerTeeth01, // end - ], - 10, // number of teeth - 8 * options.size, // starting size - 16 * options.size, // ending size - part - ) + store.set('lowerTeethLength', paths.seam.length()) - store.cutlist.addCut({ cut: 1, material: 'color4Teeth' }) + paths.teeth = createTeeth( + [ + // Array holding the points for half a mouth (bezier, not path) + points.lowerTeeth02, // start + points.lowerTeeth02cp1, // cp1 + points.lowerTeeth01cp2, // cp2 + points.lowerTeeth01, // end + ], + 10, // number of teeth + 8 * multiplier, // starting size + 16 * multiplier, // ending size + part + ) + + store.cutlist.addCut({ cut: 1, material: 'color4Teeth' }) - // Complete? - if (complete) { snippets.lowerTeeth = new Snippet('bnotch', points.lowerTeeth01) points.titleAnchor = points.lowerTeeth02.shiftFractionTowards(points.lowerTeeth03, 0.5) //.shiftFractionTowards(points.lowerTeeth01, 0.5) + points.gridAnchor = points.titleAnchor.clone() // Bounding box to prevent title clipping paths.bbox = new Path() @@ -73,39 +64,42 @@ function draftHiLowerTeeth({ at: points.titleAnchor, nr: 9, title: 'lowerTeeth', - scale: options.size / 2, + scale: multiplier / 2, }) - if (paperless) { - macro('hd', { - from: points.lowerTeeth01, - to: points.lowerTeeth03, - y: points.lowerTeeth02.y + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('hd', { - from: points.lowerTeeth02, - to: points.lowerTeeth01, - y: points.lowerTeeth02.y + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.lowerTeeth02, - to: points.lowerTeeth01, - x: points.lowerTeeth02.x - sa - 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.lowerTeeth01, - to: paths.teeth.edge('top'), - x: points.lowerTeeth02.x - sa - 10, - noStartMarker: true, - noEndMarker: true, - }) - } + macro('hd', { + from: points.lowerTeeth01, + to: points.lowerTeeth03, + y: points.lowerTeeth02.y + sa + 10, + noStartMarker: true, + noEndMarker: true, + id: 'right', + }) + macro('hd', { + from: points.lowerTeeth02, + to: points.lowerTeeth01, + y: points.lowerTeeth02.y + sa + 10, + noStartMarker: true, + noEndMarker: true, + id: 'left', + }) + + macro('vd', { + from: points.lowerTeeth02, + to: points.lowerTeeth01, + x: points.lowerTeeth02.x - sa - 10, + noStartMarker: true, + noEndMarker: true, + id: 'height', + }) + macro('vd', { + from: points.lowerTeeth01, + to: paths.teeth.edge('top'), + x: points.lowerTeeth02.x - sa - 10, + noStartMarker: true, + noEndMarker: true, + id: 'teethHeight', + }) if (sa) { let pSA = paths.seam.offset(sa) @@ -116,12 +110,7 @@ function draftHiLowerTeeth({ .line(paths.seam.end()) .attr('class', 'fabric sa') } - } - return part -} - -export const lowerTeeth = { - name: 'hi.lowerTeeth', - draft: draftHiLowerTeeth, + return part + }, } diff --git a/designs/hi/src/mouth.mjs b/designs/hi/src/mouth.mjs index 59ba8936063..4d8ea5c2b19 100644 --- a/designs/hi/src/mouth.mjs +++ b/designs/hi/src/mouth.mjs @@ -1,81 +1,70 @@ import { lowerTeeth } from './lowerTeeth.mjs' import { upperTeeth } from './upperTeeth.mjs' -function draftHiMouth({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - const mouth01_02d = 141.93684055893488 * options.size - const mouth01_02a = 312.8254216093024 - const mouth01_03d = 42.496 * options.size - const mouth01_03a = 270 - const mouth01cp1d = 38.6204 * options.size - const mouth01cp1a = 0 - const mouth02cp1d = 59.58739935676417 * options.size - const mouth02cp2d = 73.53520117766728 * options.size - const mouth02cp1a = 128.07726051101747 - const mouth02cp2a = 95.21339058299296 - const mouth03cp2d = 33.142 * options.size - const mouth03cp2a = 0 +export const mouth = { + name: 'hi.mouth', + after: [lowerTeeth, upperTeeth], + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') - points.mouth01 = new Point(0, 0) - points.mouth02 = points.mouth01.shift(mouth01_02a, mouth01_02d) - points.mouth03 = points.mouth01.shift(mouth01_03a, mouth01_03d) + const mouth01_02d = 141.93684055893488 * multiplier + const mouth01_02a = 312.8254216093024 + const mouth01_03d = 42.496 * multiplier + const mouth01_03a = 270 + const mouth01cp1d = 38.6204 * multiplier + const mouth01cp1a = 0 + const mouth02cp1d = 59.58739935676417 * multiplier + const mouth02cp2d = 73.53520117766728 * multiplier + const mouth02cp1a = 128.07726051101747 + const mouth02cp2a = 95.21339058299296 + const mouth03cp2d = 33.142 * multiplier + const mouth03cp2a = 0 - points.mouth01cp1 = points.mouth01.shift(mouth01cp1a, mouth01cp1d) - points.mouth02cp1 = points.mouth02.shift(mouth02cp1a, mouth02cp1d) - points.mouth02cp2 = points.mouth02.shift(mouth02cp2a, mouth02cp2d) - points.mouth03cp2 = points.mouth03.shift(mouth03cp2a, mouth03cp2d) + points.mouth01 = new Point(0, 0) + points.mouth02 = points.mouth01.shift(mouth01_02a, mouth01_02d) + points.mouth03 = points.mouth01.shift(mouth01_03a, mouth01_03d) - points.mouth04 = points.mouth02.flipX() + points.mouth01cp1 = points.mouth01.shift(mouth01cp1a, mouth01cp1d) + points.mouth02cp1 = points.mouth02.shift(mouth02cp1a, mouth02cp1d) + points.mouth02cp2 = points.mouth02.shift(mouth02cp2a, mouth02cp2d) + points.mouth03cp2 = points.mouth03.shift(mouth03cp2a, mouth03cp2d) - points.mouth01cp2 = points.mouth01cp1.flipX() - points.mouth04cp2 = points.mouth02cp1.flipX() - points.mouth04cp1 = points.mouth02cp2.flipX() - points.mouth03cp1 = points.mouth03cp2.flipX() + points.mouth04 = points.mouth02.flipX() - paths.aboveMouth = new Path() - .move(points.mouth02) - .curve(points.mouth02cp2, points.mouth01cp1, points.mouth01) - .curve(points.mouth01cp2, points.mouth04cp1, points.mouth04) - .attr('data-text-class', 'text-xs') - paths.belly = new Path() - .move(points.mouth04) - .curve(points.mouth04cp2, points.mouth03cp1, points.mouth03) - .curve(points.mouth03cp2, points.mouth02cp1, points.mouth02) - .attr('data-text-class', 'text-xs') - paths.seam = new Path().move(points.mouth02).join(paths.aboveMouth).join(paths.belly).close() + points.mouth01cp2 = points.mouth01cp1.flipX() + points.mouth04cp2 = points.mouth02cp1.flipX() + points.mouth04cp1 = points.mouth02cp2.flipX() + points.mouth03cp1 = points.mouth03cp2.flipX() - store.set( - 'mouthTopLength', - new Path() - .move(points.mouth01) - .curve(points.mouth01cp1, points.mouth02cp2, points.mouth02) - .length() - ) - store.set( - 'mouthBottomLength', - new Path() - .move(points.mouth03) - .curve(points.mouth03cp1, points.mouth04cp2, points.mouth04) - .length() - ) + paths.aboveMouth = new Path() + .move(points.mouth02) + .curve(points.mouth02cp2, points.mouth01cp1, points.mouth01) + .curve(points.mouth01cp2, points.mouth04cp1, points.mouth04) + .attr('data-text-class', 'text-xs') + paths.belly = new Path() + .move(points.mouth04) + .curve(points.mouth04cp2, points.mouth03cp1, points.mouth03) + .curve(points.mouth03cp2, points.mouth02cp1, points.mouth02) + .attr('data-text-class', 'text-xs') + paths.seam = new Path().move(points.mouth02).join(paths.aboveMouth).join(paths.belly).close() - store.cutlist.addCut({ cut: 1, material: 'color3Mouth' }) + store.set( + 'mouthTopLength', + new Path() + .move(points.mouth01) + .curve(points.mouth01cp1, points.mouth02cp2, points.mouth02) + .length() + ) + store.set( + 'mouthBottomLength', + new Path() + .move(points.mouth03) + .curve(points.mouth03cp1, points.mouth04cp2, points.mouth04) + .length() + ) + + store.cutlist.addCut({ cut: 1, material: 'color3Mouth' }) - // Complete? - if (complete) { points.mouthUpperTeeth1 = new Path() .move(points.mouth01) .curve(points.mouth01cp1, points.mouth02cp2, points.mouth02) @@ -102,6 +91,7 @@ function draftHiMouth({ macro('banner', { path: paths.aboveMouth, text: 'aboveMouth', + id: 'aboveMouth', dy: 0, spaces: 4, repeat: 6, @@ -109,6 +99,7 @@ function draftHiMouth({ macro('banner', { path: paths.belly, text: 'belly', + id: 'belly', dy: 0, spaces: 4, repeat: 6, @@ -116,51 +107,50 @@ function draftHiMouth({ points.titleAnchor = points.mouth01.shiftFractionTowards(points.mouth02, 0.33) points.logoAnchor = points.mouth01.shiftFractionTowards(points.mouth04, 0.3) + points.gridAnchor = points.mouth03.clone() snippets.logo = new Snippet('logo', points.logoAnchor).attr( 'data-scale', - (options.size > 1 ? 1 : options.size) / 2 + (multiplier > 1 ? 1 : multiplier) / 2 ) macro('title', { at: points.titleAnchor, nr: 4, title: 'mouth', - scale: (options.size > 1 ? 1 : options.size) / 2, + scale: (multiplier > 1 ? 1 : multiplier) / 2, + }) + + macro('hd', { + from: points.mouth03, + to: points.mouth02, + y: points.mouth02.y + sa + 10, + id: 'right', + }) + macro('hd', { + from: points.mouth04, + to: points.mouth03, + y: points.mouth02.y + sa + 10, + id: 'left', + }) + + macro('vd', { + from: points.mouth04, + to: points.mouth03, + x: points.mouth04.x - sa - 10, + id: 'heightInside', + }) + macro('vd', { + from: points.mouth03, + to: points.mouth01, + x: points.mouth04.x - sa - 10, + id: 'heightOutside', }) - if (paperless) { - macro('hd', { - from: points.mouth03, - to: points.mouth02, - y: points.mouth02.y + sa + 10, - }) - macro('hd', { - from: points.mouth04, - to: points.mouth03, - y: points.mouth02.y + sa + 10, - }) - macro('vd', { - from: points.mouth04, - to: points.mouth03, - x: points.mouth04.x - sa - 10, - }) - macro('vd', { - from: points.mouth03, - to: points.mouth01, - x: points.mouth04.x - sa - 10, - }) - } if (sa) { paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') } - } - return part -} - -export const mouth = { - name: 'hi.mouth', - after: [lowerTeeth, upperTeeth], - draft: draftHiMouth, + return part + }, } diff --git a/designs/hi/src/tail.mjs b/designs/hi/src/tail.mjs index c073319fc83..0aa1bedfe10 100644 --- a/designs/hi/src/tail.mjs +++ b/designs/hi/src/tail.mjs @@ -1,90 +1,79 @@ import { body } from './body.mjs' -function draftHiTail({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - const tail01_02d = 192.0129724628 * options.size - const tail01_02a = 53.242955551234914 - const tail01_03d = 115.38057785000036 * options.size - const tail01_03a = 106.95066736265407 - const tail01_04d = 230.05210782342334 * options.size - const tail01_04a = 138.66344842617497 - const tail01_05d = 95.12771141996424 * options.size - const tail01_05a = 173.38284569091573 - const tail01cp1d = 156.52907796955816 * options.size - const tail01cp2d = 33.33694275124821 * options.size - const tail01cp1a = 40.69161792982998 - const tail01cp2a = 150.8191939475001 - const tail02cp1d = 20.1307852802616 * options.size - const tail02cp2d = 26.418081118809575 * options.size - const tail02cp1a = 129.66709301725697 - const tail02cp2a = 303.9168409570558 - const tail03cp1d = 41.577 * options.size - const tail03cp2d = 41.575999999999965 * options.size - const tail03cp1a = 180 - const tail03cp2a = -0 - const tail04cp1d = 18.83137554720844 * options.size - const tail04cp2d = 18.830271479721173 * options.size - const tail04cp1a = 218.47354143777738 - const tail04cp2a = 38.483984913053284 - const tail05cp1d = 38.59528397356339 * options.size - const tail05cp2d = 126.7372982195849 * options.size - const tail05cp1a = 14.169822482118544 - const tail05cp2a = 128.3396902984 +export const tail = { + name: 'hi.tail', + after: body, + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') - points.tail01 = new Point(0, 0) - points.tail02 = points.tail01.shift(tail01_02a, tail01_02d) - points.tail03 = points.tail01.shift(tail01_03a, tail01_03d) - points.tail04 = points.tail01.shift(tail01_04a, tail01_04d) - points.tail05 = points.tail01.shift(tail01_05a, tail01_05d) + const tail01_02d = 192.0129724628 * multiplier + const tail01_02a = 53.242955551234914 + const tail01_03d = 115.38057785000036 * multiplier + const tail01_03a = 106.95066736265407 + const tail01_04d = 230.05210782342334 * multiplier + const tail01_04a = 138.66344842617497 + const tail01_05d = 95.12771141996424 * multiplier + const tail01_05a = 173.38284569091573 + const tail01cp1d = 156.52907796955816 * multiplier + const tail01cp2d = 33.33694275124821 * multiplier + const tail01cp1a = 40.69161792982998 + const tail01cp2a = 150.8191939475001 + const tail02cp1d = 20.1307852802616 * multiplier + const tail02cp2d = 26.418081118809575 * multiplier + const tail02cp1a = 129.66709301725697 + const tail02cp2a = 303.9168409570558 + const tail03cp1d = 41.577 * multiplier + const tail03cp2d = 41.575999999999965 * multiplier + const tail03cp1a = 180 + const tail03cp2a = -0 + const tail04cp1d = 18.83137554720844 * multiplier + const tail04cp2d = 18.830271479721173 * multiplier + const tail04cp1a = 218.47354143777738 + const tail04cp2a = 38.483984913053284 + const tail05cp1d = 38.59528397356339 * multiplier + const tail05cp2d = 126.7372982195849 * multiplier + const tail05cp1a = 14.169822482118544 + const tail05cp2a = 128.3396902984 - points.tail01cp1 = points.tail01.shift(tail01cp1a, tail01cp1d) - points.tail01cp2 = points.tail01.shift(tail01cp2a, tail01cp2d) - points.tail02cp1 = points.tail02.shift(tail02cp1a, tail02cp1d) - points.tail02cp2 = points.tail02.shift(tail02cp2a, tail02cp2d) - points.tail03cp1 = points.tail03.shift(tail03cp1a, tail03cp1d) - points.tail03cp2 = points.tail03.shift(tail03cp2a, tail03cp2d) - points.tail04cp1 = points.tail04.shift(tail04cp1a, tail04cp1d) - points.tail04cp2 = points.tail04.shift(tail04cp2a, tail04cp2d) - points.tail05cp1 = points.tail05.shift(tail05cp1a, tail05cp1d) - points.tail05cp2 = points.tail05.shift(tail05cp2a, tail05cp2d) + points.tail01 = new Point(0, 0) + points.tail02 = points.tail01.shift(tail01_02a, tail01_02d) + points.tail03 = points.tail01.shift(tail01_03a, tail01_03d) + points.tail04 = points.tail01.shift(tail01_04a, tail01_04d) + points.tail05 = points.tail01.shift(tail01_05a, tail01_05d) - // Adjust tail opening: - points.tail05 = points.tail01.shift(points.tail01.angle(points.tail05), store.get('tailWidth')) - points.tail01cp2 = points.tail01.shift( - points.tail01.angle(points.tail05) - store.get('tailCpAngle'), - store.get('tailCpDist') - ) - points.tail05cp1 = points.tail05.shift( - points.tail05.angle(points.tail01) + store.get('tailCpAngle'), - store.get('tailCpDist') - ) + points.tail01cp1 = points.tail01.shift(tail01cp1a, tail01cp1d) + points.tail01cp2 = points.tail01.shift(tail01cp2a, tail01cp2d) + points.tail02cp1 = points.tail02.shift(tail02cp1a, tail02cp1d) + points.tail02cp2 = points.tail02.shift(tail02cp2a, tail02cp2d) + points.tail03cp1 = points.tail03.shift(tail03cp1a, tail03cp1d) + points.tail03cp2 = points.tail03.shift(tail03cp2a, tail03cp2d) + points.tail04cp1 = points.tail04.shift(tail04cp1a, tail04cp1d) + points.tail04cp2 = points.tail04.shift(tail04cp2a, tail04cp2d) + points.tail05cp1 = points.tail05.shift(tail05cp1a, tail05cp1d) + points.tail05cp2 = points.tail05.shift(tail05cp2a, tail05cp2d) - paths.seam = new Path() - .move(points.tail01) - .curve(points.tail01cp1, points.tail02cp2, points.tail02) - .curve(points.tail02cp1, points.tail03cp2, points.tail03) - .curve(points.tail03cp1, points.tail04cp2, points.tail04) - .curve(points.tail04cp1, points.tail05cp2, points.tail05) - .curve(points.tail05cp1, points.tail01cp2, points.tail01) - .close() + // Adjust tail opening: + points.tail05 = points.tail01.shift(points.tail01.angle(points.tail05), store.get('tailWidth')) + points.tail01cp2 = points.tail01.shift( + points.tail01.angle(points.tail05) - store.get('tailCpAngle'), + store.get('tailCpDist') + ) + points.tail05cp1 = points.tail05.shift( + points.tail05.angle(points.tail01) + store.get('tailCpAngle'), + store.get('tailCpDist') + ) - store.cutlist.addCut({ material: 'color1UpperBody' }) + paths.seam = new Path() + .move(points.tail01) + .curve(points.tail01cp1, points.tail02cp2, points.tail02) + .curve(points.tail02cp1, points.tail03cp2, points.tail03) + .curve(points.tail03cp1, points.tail04cp2, points.tail04) + .curve(points.tail04cp1, points.tail05cp2, points.tail05) + .curve(points.tail05cp1, points.tail01cp2, points.tail01) + .close() + + store.cutlist.addCut({ material: 'color1UpperBody' }) - // Complete? - if (complete) { points.tailSnippet = new Path() .move(points.tail01) .curve(points.tail01cp2, points.tail05cp1, points.tail05) @@ -96,117 +85,119 @@ function draftHiTail({ .curve(points.tail05cp1, points.tail01cp2, points.tail01) .attr('class', 'hidden') .attr('data-text-class', 'text-xs') - macro('banner', { - path: paths.body, - text: 'body', - dy: 0, - spaces: 10, - repeat: 3, - }) points.titleAnchor = points.tail03.shiftFractionTowards(points.tail01, 0.4) points.logoAnchor = points.tail03.shiftFractionTowards(points.tail05, 0.5) + points.gridAnchor = points.tail03.clone() + + points.tailLeft = new Path() + .move(points.tail03) + .curve(points.tail03cp1, points.tail04cp2, points.tail04) + .curve(points.tail04cp1, points.tail05cp2, points.tail05) + .edge('left') + points.tailRight = new Path() + .move(points.tail01) + .curve(points.tail01cp1, points.tail02cp2, points.tail02) + .curve(points.tail02cp1, points.tail03cp2, points.tail03) + .edge('right') + points.tailTopLeft = new Path() + .move(points.tail03) + .curve(points.tail03cp1, points.tail04cp2, points.tail04) + .curve(points.tail04cp1, points.tail05cp2, points.tail05) + .edge('top') + points.tailTopRight = new Path() + .move(points.tail01) + .curve(points.tail01cp1, points.tail02cp2, points.tail02) + .curve(points.tail02cp1, points.tail03cp2, points.tail03) + .edge('top') snippets.logo = new Snippet('logo', points.logoAnchor).attr( 'data-scale', - (options.size > 1 ? 1 : options.size) / 2 + (multiplier > 1 ? 1 : multiplier) / 2 ) macro('title', { at: points.titleAnchor, nr: 3, title: 'tail', - scale: (options.size > 1 ? 1 : options.size) / 2, + scale: (multiplier > 1 ? 1 : multiplier) / 2, }) - if (paperless) { - points.tailLeft = new Path() - .move(points.tail03) - .curve(points.tail03cp1, points.tail04cp2, points.tail04) - .curve(points.tail04cp1, points.tail05cp2, points.tail05) - .edge('left') - points.tailRight = new Path() - .move(points.tail01) - .curve(points.tail01cp1, points.tail02cp2, points.tail02) - .curve(points.tail02cp1, points.tail03cp2, points.tail03) - .edge('right') - points.tailTopLeft = new Path() - .move(points.tail03) - .curve(points.tail03cp1, points.tail04cp2, points.tail04) - .curve(points.tail04cp1, points.tail05cp2, points.tail05) - .edge('top') - points.tailTopRight = new Path() - .move(points.tail01) - .curve(points.tail01cp1, points.tail02cp2, points.tail02) - .curve(points.tail02cp1, points.tail03cp2, points.tail03) - .edge('top') - macro('hd', { - from: points.tailLeft, - to: points.tail05, - y: points.tail01.y + sa + 10, - }) - macro('hd', { - from: points.tail05, - to: points.tail01, - y: points.tail01.y + sa + 10, - }) - macro('hd', { - from: points.tail01, - to: points.tailRight, - y: points.tail01.y + sa + 10, - }) - macro('hd', { - from: points.tailLeft, - to: points.tail03, - y: points.tailTopLeft.y - sa - 10, - }) - macro('hd', { - from: points.tail03, - to: points.tailRight, - y: points.tailTopRight.y - sa - 10, - }) - macro('vd', { - from: points.tailTopLeft, - to: points.tail03, - x: points.tail03.x - 20, - }) - macro('vd', { - from: points.tail05, - to: points.tailTopLeft, - x: points.tailLeft.x - sa - 20, - }) - macro('vd', { - from: points.tailTopRight, - to: points.tail01, - x: points.tailRight.x + sa + 20, - }) - macro('vd', { - from: points.tail01, - to: points.tailTopRight, - x: points.tail03.x + 20, - }) - macro('vd', { - from: points.tail03, - to: points.tail01, - x: points.tail01.x + 20, - }) - macro('vd', { - from: points.tail05, - to: points.tail03, - x: points.tail05.x - 20, - }) - } + macro('banner', { + path: paths.body, + text: 'body', + id: 'body', + dy: 0, + spaces: 10, + repeat: 3, + }) + + macro('hd', { + from: points.tailLeft, + to: points.tail05, + y: points.tail01.y + sa + 10, + id: 'leftToBody', + }) + macro('hd', { + from: points.tail05, + to: points.tail01, + y: points.tail01.y + sa + 10, + id: 'bodyWidth', + }) + macro('hd', { + from: points.tail01, + to: points.tailRight, + y: points.tail01.y + sa + 10, + id: 'bodyToRight', + }) + macro('hd', { + from: points.tailLeft, + to: points.tail03, + y: points.tailTopRight.y - sa - 10, + id: 'leftToMid', + }) + macro('hd', { + from: points.tail03, + to: points.tailRight, + y: points.tailTopRight.y - sa - 10, + id: 'midToRight', + }) + + macro('vd', { + from: points.tailTopLeft, + to: points.tail03, + x: points.tail03.x - 20, + id: 'leftToMid', + }) + macro('vd', { + from: points.tail05, + to: points.tailTopLeft, + x: points.tailLeft.x - sa - 20, + id: 'heightLeft', + }) + macro('vd', { + from: points.tailTopRight, + to: points.tail01, + x: points.tailRight.x + sa + 20, + id: 'heightRight', + }) + macro('vd', { + from: points.tail03, + to: points.tail01, + x: points.tail01.x + 20, + id: 'rightToMid', + }) + macro('vd', { + from: points.tail05, + to: points.tail03, + x: points.tail05.x - 20, + id: 'leftToMid', + }) if (sa) { paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') } - } - return part -} - -export const tail = { - name: 'hi.tail', - after: body, - draft: draftHiTail, + return part + }, } diff --git a/designs/hi/src/topFin.mjs b/designs/hi/src/topFin.mjs index 5bcf84c0def..1d5ab60dc92 100644 --- a/designs/hi/src/topFin.mjs +++ b/designs/hi/src/topFin.mjs @@ -1,87 +1,76 @@ import { body } from './body.mjs' -function draftHiTopFin({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - let topFinOpening = store.get('topFinOpening') - const topFinOpeningLength = store.get('topFinOpeningLength') +export const topOfFin = { + name: 'hi.topOfFin', + after: body, + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') - const topFin01_02d = 256.9537569065251 * options.size - const topFin01_02a = 325.46697637215823 - const topFin01_03a = 275.4353725228365 - const topFin01cp1d = 178.52481158058 * options.size - const topFin01cp2d = 27.240286624072077 * options.size - const topFin01cp1a = 346.31732410079576 - const topFin01cp2a = 254.05347154462484 - const topFin02cp1d = 25.871054481794893 * options.size - const topFin02cp2d = 12.154549189501026 * options.size - const topFin02cp1a = 236.80010054081936 - const topFin02cp2a = 56.66685795767527 - const topFin03cp1d = 39.024661651837555 * options.size - const topFin03cp2d = 76.08965682877273 * options.size - const topFin03cp1a = 113.40393219481112 - const topFin03cp2a = 22.511206474810457 + let topOfFinOpening = store.get('topOfFinOpening') + const topOfFinOpeningLength = store.get('topOfFinOpeningLength') - let diff = 0 - let iteration = 0 - do { - points.topFin01 = new Point(0, 0) - points.topFin02 = points.topFin01.shift(topFin01_02a, topFin01_02d) - points.topFin03 = points.topFin01.shift(topFin01_03a, topFinOpening) // topFin01_03d + const topOfFin01_02d = 256.9537569065251 * multiplier + const topOfFin01_02a = 325.46697637215823 + const topOfFin01_03a = 275.4353725228365 + const topOfFin01cp1d = 178.52481158058 * multiplier + const topOfFin01cp2d = 27.240286624072077 * multiplier + const topOfFin01cp1a = 346.31732410079576 + const topOfFin01cp2a = 254.05347154462484 + const topOfFin02cp1d = 25.871054481794893 * multiplier + const topOfFin02cp2d = 12.154549189501026 * multiplier + const topOfFin02cp1a = 236.80010054081936 + const topOfFin02cp2a = 56.66685795767527 + const topOfFin03cp1d = 39.024661651837555 * multiplier + const topOfFin03cp2d = 76.08965682877273 * multiplier + const topOfFin03cp1a = 113.40393219481112 + const topOfFin03cp2a = 22.511206474810457 - points.topFin01cp1 = points.topFin01.shift(topFin01cp1a, topFin01cp1d) - points.topFin01cp2 = points.topFin01.shift(topFin01cp2a, topFin01cp2d) - points.topFin02cp1 = points.topFin02.shift(topFin02cp1a, topFin02cp1d) - points.topFin02cp2 = points.topFin02.shift(topFin02cp2a, topFin02cp2d) - points.topFin03cp1 = points.topFin03.shift(topFin03cp1a, topFin03cp1d) - points.topFin03cp2 = points.topFin03.shift(topFin03cp2a, topFin03cp2d) + let diff = 0 + let iteration = 0 + do { + points.topOfFin01 = new Point(0, 0) + points.topOfFin02 = points.topOfFin01.shift(topOfFin01_02a, topOfFin01_02d) + points.topOfFin03 = points.topOfFin01.shift(topOfFin01_03a, topOfFinOpening) // topOfFin01_03d - diff = - topFinOpeningLength - + points.topOfFin01cp1 = points.topOfFin01.shift(topOfFin01cp1a, topOfFin01cp1d) + points.topOfFin01cp2 = points.topOfFin01.shift(topOfFin01cp2a, topOfFin01cp2d) + points.topOfFin02cp1 = points.topOfFin02.shift(topOfFin02cp1a, topOfFin02cp1d) + points.topOfFin02cp2 = points.topOfFin02.shift(topOfFin02cp2a, topOfFin02cp2d) + points.topOfFin03cp1 = points.topOfFin03.shift(topOfFin03cp1a, topOfFin03cp1d) + points.topOfFin03cp2 = points.topOfFin03.shift(topOfFin03cp2a, topOfFin03cp2d) + + diff = + topOfFinOpeningLength - + new Path() + .move(points.topOfFin03) + .curve(points.topOfFin03cp1, points.topOfFin01cp2, points.topOfFin01) + .length() + + topOfFinOpening = topOfFinOpening + diff + iteration++ + } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + + paths.seam = new Path() + .move(points.topOfFin01) + .curve(points.topOfFin01cp2, points.topOfFin03cp1, points.topOfFin03) + .curve(points.topOfFin03cp2, points.topOfFin02cp1, points.topOfFin02) + .curve(points.topOfFin02cp2, points.topOfFin01cp1, points.topOfFin01) + .close() + + store.set( + 'topOfFinCircumference', new Path() - .move(points.topFin03) - .curve(points.topFin03cp1, points.topFin01cp2, points.topFin01) + .move(points.topOfFin01) + .curve(points.topOfFin01cp1, points.topOfFin02cp2, points.topOfFin02) + .curve(points.topOfFin02cp1, points.topOfFin03cp2, points.topOfFin03) .length() + ) - topFinOpening = topFinOpening + diff - iteration++ - } while (Math.abs(diff) > store.get('tolerance') && iteration < 100) + store.cutlist.addCut({ cut: 2, material: 'color1UpperBody' }) - paths.seam = new Path() - .move(points.topFin01) - .curve(points.topFin01cp2, points.topFin03cp1, points.topFin03) - .curve(points.topFin03cp2, points.topFin02cp1, points.topFin02) - .curve(points.topFin02cp2, points.topFin01cp1, points.topFin01) - .close() - - store.set( - 'topFinCircumference', - new Path() - .move(points.topFin01) - .curve(points.topFin01cp1, points.topFin02cp2, points.topFin02) - .curve(points.topFin02cp1, points.topFin03cp2, points.topFin03) - .length() - ) - - store.cutlist.addCut({ material: 'color1UpperBody' }) - - // Complete? - if (complete) { paths.body = new Path() - .move(points.topFin01) - .curve(points.topFin01cp2, points.topFin03cp1, points.topFin03) + .move(points.topOfFin01) + .curve(points.topOfFin01cp2, points.topOfFin03cp1, points.topOfFin03) .attr('class', 'hidden') .attr('data-text-class', 'text-xs') macro('banner', { @@ -92,85 +81,75 @@ function draftHiTopFin({ repeat: 3, }) - points.titleAnchor = points.topFin01 - .shiftFractionTowards(points.topFin02, 0.5) - .shiftFractionTowards(points.topFin03, 0.1) - points.logoAnchor = points.titleAnchor.shiftFractionTowards(points.topFin03, 0.4) + points.titleAnchor = points.topOfFin01 + .shiftFractionTowards(points.topOfFin02, 0.5) + .shiftFractionTowards(points.topOfFin03, 0.1) + points.logoAnchor = points.titleAnchor.shiftFractionTowards(points.topOfFin03, 0.4) + points.gridAnchor = points.titleAnchor.clone() snippets.logo = new Snippet('logo', points.logoAnchor).attr( 'data-scale', - (options.size > 1 ? 1 : options.size) / 2 + (multiplier > 1 ? 1 : multiplier) / 2 ) macro('title', { at: points.titleAnchor, nr: 7, - title: 'topFin', - scale: (options.size > 1 ? 1 : options.size) / 2, + title: 'topOfFin', + scale: (multiplier > 1 ? 1 : multiplier) / 2, }) - if (paperless) { - points.topFinLeft = paths.seam.edge('left') - const tempPath = new Path() - .move(points.topFin02) - .curve(points.topFin02cp1, points.topFin03cp2, points.topFin03) - points.topFinInsideTop = tempPath.edge('top') - const tempPoint = tempPath.shiftFractionAlong(0.5) - points.topFinInsideBottom = tempPath.split(tempPoint)[0].edge('bottom') - points.topFinRight = paths.seam.edge('right') + points.topOfFinLeft = paths.seam.edge('left') + const tempPath = new Path() + .move(points.topOfFin02) + .curve(points.topOfFin02cp1, points.topOfFin03cp2, points.topOfFin03) + points.topOfFinInsideTop = tempPath.edge('top') + const tempPoint = tempPath.shiftFractionAlong(0.5) + points.topOfFinInsideBottom = tempPath.split(tempPoint)[0].edge('bottom') + points.topOfFinRight = paths.seam.edge('right') - macro('hd', { - from: points.topFin01, - to: points.topFinRight, - y: points.topFin01.y - sa - 10, - // id: 'smallTop', - // noStartMarker: true, - // noEndMarker: true, - }) - 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, - // id: 'smallBottom', - // noStartMarker: true, - // noEndMarker: true, - }) - macro('vd', { - from: points.topFin03, - to: points.topFin01, - x: points.topFinLeft.x - sa - 10, - }) - 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, - }) - } - // if( options.size < 1.5 ) { - // paths.smallTop.attr('data-text-class', 'text-xs') - // paths.smallBottom.attr('data-text-class', 'text-xs') - // } + macro('hd', { + from: points.topOfFin01, + to: points.topOfFinRight, + y: points.topOfFin01.y - sa - 10, + id: 'topWidth', + }) + macro('hd', { + from: points.topOfFin03, + to: points.topOfFinRight, + y: points.topOfFin03.y + sa + 20, + id: 'bottomWidth', + }) + macro('hd', { + from: points.topOfFinLeft, + to: points.topOfFinRight, + y: points.topOfFin03.y + sa + 10, + id: 'width', + }) + + macro('vd', { + from: points.topOfFin03, + to: points.topOfFin01, + x: points.topOfFinLeft.x - sa - 10, + id: 'leftHeight', + }) + macro('vd', { + from: points.topOfFin01, + to: points.topOfFinInsideBottom, + x: points.topOfFin02.x + sa + 10, + id: 'rightHeight', + }) + macro('vd', { + from: points.topOfFinInsideTop, + to: points.topOfFin01, + x: points.topOfFinLeft.x - sa - 20, + id: 'minHeight', + }) if (sa) { paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') } - } - return part -} - -export const topFin = { - name: 'hi.topFin', - after: body, - draft: draftHiTopFin, + return part + }, } diff --git a/designs/hi/src/upperTeeth.mjs b/designs/hi/src/upperTeeth.mjs index 03dfba27ad9..4d05b2a4f4a 100644 --- a/designs/hi/src/upperTeeth.mjs +++ b/designs/hi/src/upperTeeth.mjs @@ -1,111 +1,93 @@ +import { body } from './body.mjs' import { createTeeth } from './teeth.mjs' -function draftHiUpperTeeth({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - const upperTeeth01_02d = 131.305041182736 * options.size - const upperTeeth01_02a = 34.147056946748805 - const upperTeeth02cp1d = 64.30113337316406 * options.size - const upperTeeth02cp1a = 55.1335930733262 + 180 - const upperTeeth01cp2d = 48.331000000000017 * options.size - const upperTeeth01cp2a = 0 +export const upperTeeth = { + name: 'hi.upperTeeth', + after: body, + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, macro, part }) => { + const multiplier = store.get('multiplier') - points.upperTeeth01 = new Point(0, 0) - points.upperTeeth02 = points.upperTeeth01.shift(upperTeeth01_02a, upperTeeth01_02d) - points.upperTeeth01cp2 = points.upperTeeth01.shift(upperTeeth01cp2a, upperTeeth01cp2d) - points.upperTeeth02cp1 = points.upperTeeth02.shift(upperTeeth02cp1a, upperTeeth02cp1d) - // Make seam symmetric to optimize generating teeth - points.upperTeeth02cp1 = points.upperTeeth02.shiftTowards( - points.upperTeeth02cp1, - points.upperTeeth01cp2.dist(points.upperTeeth01) - ) - points.upperTeeth03 = points.upperTeeth02.flipX() - points.upperTeeth01cp1 = points.upperTeeth01cp2.flipX() - points.upperTeeth03cp2 = points.upperTeeth02cp1.flipX() + const upperTeeth01_02d = 131.305041182736 * multiplier + const upperTeeth01_02a = 34.147056946748805 + const upperTeeth02cp1d = 64.30113337316406 * multiplier + const upperTeeth02cp1a = 55.1335930733262 + 180 + const upperTeeth01cp2d = 48.331000000000017 * multiplier + const upperTeeth01cp2a = 0 - paths.seam = new Path() - .move(points.upperTeeth02) - .curve(points.upperTeeth02cp1, points.upperTeeth01cp2, points.upperTeeth01) - .curve(points.upperTeeth01cp1, points.upperTeeth03cp2, points.upperTeeth03) + points.upperTeeth01 = new Point(0, 0) + points.upperTeeth02 = points.upperTeeth01.shift(upperTeeth01_02a, upperTeeth01_02d) + points.upperTeeth01cp2 = points.upperTeeth01.shift(upperTeeth01cp2a, upperTeeth01cp2d) + points.upperTeeth02cp1 = points.upperTeeth02.shift(upperTeeth02cp1a, upperTeeth02cp1d) + // Make seam symmetric to optimize generating teeth + points.upperTeeth02cp1 = points.upperTeeth02.shiftTowards( + points.upperTeeth02cp1, + points.upperTeeth01cp2.dist(points.upperTeeth01) + ) + points.upperTeeth03 = points.upperTeeth02.flipX() + points.upperTeeth01cp1 = points.upperTeeth01cp2.flipX() + points.upperTeeth03cp2 = points.upperTeeth02cp1.flipX() - store.set('upperTeethLength', paths.seam.length()) + paths.seam = new Path() + .move(points.upperTeeth02) + .curve(points.upperTeeth02cp1, points.upperTeeth01cp2, points.upperTeeth01) + .curve(points.upperTeeth01cp1, points.upperTeeth03cp2, points.upperTeeth03) - //paths.teeth = new Path().move(paths.seam.start()) + store.set('upperTeethLength', paths.seam.length()) - paths.teeth = createTeeth( - [ - // Array holding the points for half a mouth (bezier, not path) - points.upperTeeth03, // end - points.upperTeeth03cp2, // cp2 - points.upperTeeth01cp1, // cp1 - points.upperTeeth01, // start - ], - 14, // number of teeth - 9 * options.size, // start size - 18 * options.size, // end size - part - ) - //createTeeth(paths.seam, 18 * options.size, 9 * options.size, 15, options.aggressive, paths.teeth) + paths.teeth = createTeeth( + [ + // Array holding the points for half a mouth (bezier, not path) + points.upperTeeth03, // end + points.upperTeeth03cp2, // cp2 + points.upperTeeth01cp1, // cp1 + points.upperTeeth01, // start + ], + 14, // number of teeth + 9 * multiplier, // start size + 18 * multiplier, // end size + part + ) - store.cutlist.addCut({ cut: 1, material: 'color4Teeth' }) + store.cutlist.addCut({ cut: 1, material: 'color4Teeth' }) - // Complete? - if (complete) { snippets.upperTeeth = new Snippet('bnotch', points.upperTeeth01) points.titleAnchor = points.upperTeeth02 .shiftFractionTowards(points.upperTeeth03, 0.5) .shiftFractionTowards(points.upperTeeth01, 0.5) + points.gridAnchor = points.upperTeeth01 macro('title', { at: points.titleAnchor, nr: 8, title: 'upperTeeth', - scale: options.size / 2, + scale: multiplier / 2, }) - if (paperless) { - macro('hd', { - from: points.upperTeeth01, - to: points.upperTeeth03, - y: points.upperTeeth02.y + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('hd', { - from: points.upperTeeth02, - to: points.upperTeeth01, - y: points.upperTeeth02.y + sa + 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.upperTeeth02, - to: points.upperTeeth01, - x: points.upperTeeth02.x - sa - 10, - noStartMarker: true, - noEndMarker: true, - }) - macro('vd', { - from: points.upperTeeth01, - to: paths.teeth.edge('top'), - x: points.upperTeeth02.x - sa - 10, - noStartMarker: true, - noEndMarker: true, - }) - } + macro('hd', { + from: points.upperTeeth03, + to: points.upperTeeth01, + y: points.upperTeeth02.y - 10, + noStartMarker: true, + noEndMarker: true, + id: 'left', + }) + macro('hd', { + from: points.upperTeeth01, + to: points.upperTeeth02, + y: points.upperTeeth02.y - 10, + noStartMarker: true, + noEndMarker: true, + id: 'right', + }) + macro('vd', { + from: points.upperTeeth01, + to: paths.teeth.edge('top'), + x: points.leftTooth0.x - sa - 10, + noStartMarker: true, + noEndMarker: true, + id: 'height', + }) if (sa) { let pSA = paths.seam.reverse().offset(sa) @@ -116,12 +98,7 @@ function draftHiUpperTeeth({ .line(paths.seam.start()) .attr('class', 'fabric sa') } - } - return part -} - -export const upperTeeth = { - name: 'hi.upperTeeth', - draft: draftHiUpperTeeth, + return part + }, } diff --git a/designs/holmes/package.json b/designs/holmes/package.json index 60e8a28e184..9b9f30b9e91 100644 --- a/designs/holmes/package.json +++ b/designs/holmes/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/hortensia/package.json b/designs/hortensia/package.json index 1c9e728a3fd..ca6009f1360 100644 --- a/designs/hortensia/package.json +++ b/designs/hortensia/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/huey/package.json b/designs/huey/package.json index 601bb11b4ed..293470e988f 100644 --- a/designs/huey/package.json +++ b/designs/huey/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/hugo/package.json b/designs/hugo/package.json index e709bc57966..e003faa38f0 100644 --- a/designs/hugo/package.json +++ b/designs/hugo/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/jaeger/package.json b/designs/jaeger/package.json index 63ef3bf4bb4..10db4fb002b 100644 --- a/designs/jaeger/package.json +++ b/designs/jaeger/package.json @@ -58,7 +58,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/legend/package.json b/designs/legend/package.json index 11a5078da53..be2939b5ffa 100644 --- a/designs/legend/package.json +++ b/designs/legend/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/lucy/package.json b/designs/lucy/package.json index a0cf0d5e372..cdafeb8a3ea 100644 --- a/designs/lucy/package.json +++ b/designs/lucy/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/lunetius/package.json b/designs/lunetius/package.json index 660ff98ad2b..54d47df3de1 100644 --- a/designs/lunetius/package.json +++ b/designs/lunetius/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/magde/package.json b/designs/magde/package.json index 52cffdfc67e..b77d6c995a2 100644 --- a/designs/magde/package.json +++ b/designs/magde/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/noble/i18n/en.json b/designs/noble/i18n/en.json index 2b144342ae7..8ced1a99810 100644 --- a/designs/noble/i18n/en.json +++ b/designs/noble/i18n/en.json @@ -2,9 +2,11 @@ "t": "Noble body block", "d": "Noble is a body block with prince(ess) seams", "p": { + "back": "Back", "backInside": "Back inside", "backOutside": "Back outside", "backPoints": "Back base", + "front": "Front", "frontInside": "Front inside", "frontOutside": "Front outside", "frontPoints": "Front base" @@ -15,6 +17,14 @@ "t": "Dart position", "d": "Controls whether to split at the shoulder or armhole" }, + "dartPosition.armhole": { + "t": "Dart position at the armhole", + "d": "This moves the prince(ss) seam to the armhole" + }, + "dartPosition.shoulder": { + "t": "Dart position at the shoulder", + "d": "This moves the prince(ss) seam to the shoulder" + }, "chestEase": { "t": "Chest ease", "d": "Controls the amount of ease at the chest" @@ -93,7 +103,7 @@ }, "fullChestEaseReduction": { "t": "Full chest ease reduction", - "d": "FIXME: Document this option" + "d": "Allows you to independently reduce the ease around the chest to make it fit tight(er) in that area" } } } diff --git a/designs/noble/package.json b/designs/noble/package.json index 15c4adc6b76..375b95cb5b1 100644 --- a/designs/noble/package.json +++ b/designs/noble/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/noble/src/backinside.mjs b/designs/noble/src/backinside.mjs index 5f162301009..70bf3f19d6a 100644 --- a/designs/noble/src/backinside.mjs +++ b/designs/noble/src/backinside.mjs @@ -1,163 +1,162 @@ import { backPoints } from './backpoints.mjs' -function nobleBackInside({ - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - if (options.dartPosition != 'shoulder') { - paths.insideSeam = paths.seam.clone().unhide() - } else { - // Hide Bella paths - for (let key of Object.keys(paths)) paths[key].hide() - for (let i in snippets) delete snippets[i] +export const backInside = { + name: 'noble.backInside', + from: backPoints, + draft: ({ sa, Point, points, Path, paths, Snippet, snippets, options, macro, part }) => { + if (options.dartPosition != 'shoulder') { + paths.insideSeam = paths.seam.clone().unhide() + } else { + // Hide Bella paths + for (let key of Object.keys(paths)) paths[key].hide() + for (let i in snippets) delete snippets[i] - paths.insideSeam = new Path() - .move(points.cbNeck) - .curve_(points.cbNeckCp2, points.waistCenter) - .line(points.dartBottomLeft) - .curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip) - .curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart) - .line(points.hps) - ._curve(points.cbNeckCp1, points.cbNeck) - .close() - .attr('class', 'fabric') - } + paths.insideSeam = new Path() + .move(points.cbNeck) + .curve_(points.cbNeckCp2, points.waistCenter) + .line(points.dartBottomLeft) + .curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip) + .curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart) + .line(points.hps) + ._curve(points.cbNeckCp1, points.cbNeck) + .close() + .attr('class', 'fabric') + } - points.grainlineFrom = new Point(points.hps.x / 2, points.shoulder.y) - points.grainlineTo = new Point(points.hps.x / 2, points.waistSide.y) - macro('grainline', { - from: points.grainlineFrom, - to: points.grainlineTo, - }) + points.grainlineFrom = new Point(points.hps.x / 2, points.shoulder.y) + points.grainlineTo = new Point(points.hps.x / 2, points.waistSide.y) + macro('grainline', { + from: points.grainlineFrom, + to: points.grainlineTo, + }) - if (complete) { snippets.dartTip = new Snippet('notch', points.dartTip) macro('title', { at: points.titleAnchor, nr: 3, - title: options.dartPosition != 'shoulder' ? 'Back' : 'Inside Back', + title: options.dartPosition != 'shoulder' ? 'back' : 'backInside', }) + points.gridAnchor = points.hps.clone() if (sa) paths.sa = paths.insideSeam.offset(sa).attr('class', 'fabric sa') - if (paperless) { - if (options.dartPosition == 'shoulder') { - points.shoulderPoint = points.shoulderDart.clone() - } else { - points.shoulderPoint = points.shoulder.clone() - } + if (options.dartPosition == 'shoulder') { + points.shoulderPoint = points.shoulderDart.clone() + } else { + points.shoulderPoint = points.shoulder.clone() + } + macro('hd', { + from: points.waistCenter, + to: points.shoulderPoint, + y: points.waistCenter.y + sa + 15, + id: 'middleToShoulder', + }) + macro('hd', { + from: points.waistCenter, + to: points.dartTip, + y: points.waistCenter.y + sa + 25, + id: 'middleToDartPoint', + }) + macro('hd', { + from: points.waistCenter, + to: points.dartBottomLeft, + y: points.waistCenter.y + sa + 35, + id: 'middleToDart', + }) + macro('hd', { + from: points.cbNeck, + to: points.dartBottomLeft, + y: points.waistCenter.y + sa + 45, + id: 'neckToDart', + }) + macro('hd', { + from: points.cbNeck, + to: points.hps, + y: points.hps.y - sa - 15, + id: 'neckToHps', + }) + macro('hd', { + from: points.hps, + to: points.shoulderPoint, + y: points.hps.y - sa - 15, + id: 'hpsToShoulder', + }) + if (options.dartPosition != 'shoulder') { macro('hd', { - from: points.waistCenter, - to: points.shoulderPoint, - y: points.waistCenter.y + sa + 15, - }) - macro('hd', { - from: points.waistCenter, - to: points.dartTip, + from: points.dartTip, + to: points.waistSide, y: points.waistCenter.y + sa + 25, + id: 'dartPointToSide', }) macro('hd', { - from: points.waistCenter, - to: points.dartBottomLeft, + from: points.dartBottomRight, + to: points.waistSide, y: points.waistCenter.y + sa + 35, + id: 'dartToSide', }) macro('hd', { - from: points.cbNeck, - to: points.dartBottomLeft, + from: points.dartBottomRight, + to: points.armhole, y: points.waistCenter.y + sa + 45, - }) - macro('hd', { - from: points.cbNeck, - to: points.hps, - y: points.hps.y - sa - 15, - }) - macro('hd', { - from: points.hps, - to: points.shoulderPoint, - y: points.hps.y - sa - 15, - }) - if (options.dartPosition != 'shoulder') { - macro('hd', { - from: points.dartTip, - to: points.waistSide, - y: points.waistCenter.y + sa + 25, - }) - macro('hd', { - from: points.dartBottomRight, - to: points.waistSide, - y: points.waistCenter.y + sa + 35, - }) - macro('hd', { - from: points.dartBottomRight, - to: points.armhole, - y: points.waistCenter.y + sa + 45, - }) - } - - let extraOffset = 0 - if (options.dartPosition != 'shoulder') { - macro('vd', { - from: points.shoulderPoint, - to: points.waistSide, - x: points.shoulderPoint.x + sa + 25, - }) - macro('vd', { - from: points.armhole, - to: points.waistSide, - x: points.shoulderPoint.x + sa + 15, - }) - extraOffset = 10 - } - - macro('vd', { - from: points.shoulderPoint, - to: points.dartTip, - x: points.shoulderPoint.x + sa + 15, - }) - macro('vd', { - from: points.shoulderPoint, - to: points.dartBottomLeft, - x: points.shoulderPoint.x + sa + 25 + extraOffset, - }) - macro('vd', { - from: points.shoulderPoint, - to: points.waistCenter, - x: points.shoulderPoint.x + sa + 35 + extraOffset, - }) - macro('vd', { - from: points.hps, - to: points.waistCenter, - x: points.shoulderPoint.x + sa + 45 + extraOffset, - }) - macro('vd', { - from: points.waistCenter, - to: points.cbNeck, - x: points.cbNeck.x - sa - 15, - }) - macro('vd', { - from: points.waistCenter, - to: points.hps, - x: points.cbNeck.x - sa - 25, + id: 'dartToArmhole', }) } - } - return part -} + let extraOffset = 0 + if (options.dartPosition != 'shoulder') { + macro('vd', { + from: points.shoulderPoint, + to: points.waistSide, + x: points.shoulderPoint.x + sa + 25, + id: 'sideToShoulder', + }) + macro('vd', { + from: points.armhole, + to: points.waistSide, + x: points.shoulderPoint.x + sa + 15, + id: 'sideToArmhole', + }) + extraOffset = 10 + } -export const backInside = { - name: 'noble.backInside', - from: backPoints, - draft: nobleBackInside, + macro('vd', { + from: points.shoulderPoint, + to: points.dartTip, + x: points.shoulderPoint.x + sa + 15, + id: 'dartPointToShoulder', + }) + macro('vd', { + from: points.shoulderPoint, + to: points.dartBottomLeft, + x: points.shoulderPoint.x + sa + 25 + extraOffset, + id: 'dartToShoulder', + }) + macro('vd', { + from: points.shoulderPoint, + to: points.waistCenter, + x: points.shoulderPoint.x + sa + 35 + extraOffset, + id: 'middleToShoulder', + }) + macro('vd', { + from: points.hps, + to: points.waistCenter, + x: points.shoulderPoint.x + sa + 45 + extraOffset, + id: 'middleToHps', + }) + macro('vd', { + from: points.waistCenter, + to: points.cbNeck, + x: points.cbNeck.x - sa - 15, + id: 'hemToNeck', + }) + macro('vd', { + from: points.waistCenter, + to: points.hps, + x: points.cbNeck.x - sa - 25, + id: 'hemToHps', + }) + + return part + }, } diff --git a/designs/noble/src/backoutside.mjs b/designs/noble/src/backoutside.mjs index 89bdf3414ae..e581a9070cb 100644 --- a/designs/noble/src/backoutside.mjs +++ b/designs/noble/src/backoutside.mjs @@ -1,55 +1,44 @@ import { backPoints } from './backpoints.mjs' -function nobleBackOutside({ - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - if (options.dartPosition != 'shoulder') { - return part - } +export const backOutside = { + name: 'noble.backOutside', + from: backPoints, + draft: ({ sa, Point, points, Path, paths, Snippet, snippets, options, macro, part }) => { + if (options.dartPosition != 'shoulder') { + return part + } - paths.dart = new Path() - .move(points.shoulderDart) - .curve(points.shoulderDart, points.shoulderDartCpUp, points.dartTip) - .curve(points.shoulderDartCpDown, points.dartRightCp, points.dartBottomRight) - .hide() + paths.dart = new Path() + .move(points.shoulderDart) + .curve(points.shoulderDart, points.shoulderDartCpUp, points.dartTip) + .curve(points.shoulderDartCpDown, points.dartRightCp, points.dartBottomRight) + .hide() - paths.outsideSeam = new Path() - .move(points.dartBottomRight) - .line(points.waistSide) - .curve_(points.waistSideCp2, points.armhole) - .curve(points.armholeCp2, points.armholePitchCp1, points.armholePitch) - .curve_(points.armholePitchCp2, points.shoulder) - .line(points.shoulderDart) - .join(paths.dart) - .close() - .attr('class', 'fabric') + paths.outsideSeam = new Path() + .move(points.dartBottomRight) + .line(points.waistSide) + .curve_(points.waistSideCp2, points.armhole) + .curve(points.armholeCp2, points.armholePitchCp1, points.armholePitch) + .curve_(points.armholePitchCp2, points.shoulder) + .line(points.shoulderDart) + .join(paths.dart) + .close() + .attr('class', 'fabric') - points.grainlineFrom = new Point( - Math.max(points.shoulderDart.x, points.dartBottomRight.x), - points.shoulder.y - ) - points.grainlineTo = new Point( - points.grainlineFrom.x, - points.waistSide.y - (points.waistSide.y - points.shoulder.y) * 0.4 - ) + points.grainlineFrom = new Point( + Math.max(points.shoulderDart.x, points.dartBottomRight.x), + points.shoulder.y + ) + points.grainlineTo = new Point( + points.grainlineFrom.x, + points.waistSide.y - (points.waistSide.y - points.shoulder.y) * 0.4 + ) - macro('grainline', { - from: points.grainlineFrom, - to: points.grainlineTo, - }) + macro('grainline', { + from: points.grainlineFrom, + to: points.grainlineTo, + }) - if (complete) { snippets.dartTip = new Snippet('notch', points.dartTip) points.titleAnchor = points.dartBottomRight @@ -58,81 +47,87 @@ function nobleBackOutside({ macro('title', { at: points.titleAnchor, nr: 4, - title: 'Outside Back', + title: 'backOutside', }) + points.gridAnchor = points.armholeCpTarget.clone() if (sa) paths.sa = paths.outsideSeam.offset(sa).attr('class', 'fabric sa') - if (paperless) { - let pLeft = paths.dart.edge('left') - macro('hd', { - from: pLeft, - to: points.waistSide, - y: points.waistCenter.y + sa + 15, - }) - macro('hd', { - from: points.dartBottomRight, - to: points.armhole, - y: points.waistCenter.y + sa + 25, - }) - macro('hd', { - from: points.dartTip, - to: points.waistSide, - y: points.waistCenter.y + sa + 35, - }) - macro('hd', { - from: points.dartBottomRight, - to: points.waistSide, - y: points.waistCenter.y + sa + 45, - }) - macro('hd', { - from: pLeft, - to: points.shoulder, - y: points.shoulderDart.y - sa - 15, - }) - macro('hd', { - from: points.shoulderDart, - to: points.shoulder, - y: points.shoulderDart.y - sa - 25, - }) - macro('hd', { - from: points.shoulderDart, - to: points.armhole, - y: points.shoulderDart.y - sa - 35, - }) - macro('vd', { - from: points.shoulder, - to: points.dartTip, - x: points.armhole.x + sa + 15, - }) - macro('vd', { - from: points.armhole, - to: points.waistSide, - x: points.armhole.x + sa + 15, - }) - macro('vd', { - from: points.shoulder, - to: points.waistSide, - x: points.armhole.x + sa + 25, - }) - macro('vd', { - from: points.shoulder, - to: points.dartBottomRight, - x: points.armhole.x + sa + 35, - }) - macro('vd', { - from: points.shoulderDart, - to: points.dartBottomRight, - x: points.armhole.x + sa + 45, - }) - } - } + let pLeft = paths.dart.edge('left') + macro('hd', { + from: pLeft, + to: points.waistSide, + y: points.waistCenter.y + sa + 15, + id: 'leftToSide', + }) + macro('hd', { + from: points.dartBottomRight, + to: points.armhole, + y: points.waistCenter.y + sa + 25, + id: 'dartToArmhole', + }) + macro('hd', { + from: points.dartTip, + to: points.waistSide, + y: points.waistCenter.y + sa + 35, + id: 'leftToSide', + }) + macro('hd', { + from: points.dartBottomRight, + to: points.waistSide, + y: points.waistCenter.y + sa + 45, + id: 'dartToSide', + }) + macro('hd', { + from: pLeft, + to: points.shoulder, + y: points.shoulderDart.y - sa - 15, + id: 'leftToShoulder', + }) + macro('hd', { + from: points.shoulderDart, + to: points.shoulder, + y: points.shoulderDart.y - sa - 25, + id: 'dartToShoulder', + }) + macro('hd', { + from: points.shoulderDart, + to: points.armhole, + y: points.shoulderDart.y - sa - 35, + id: 'dartToArmhole', + }) - return part -} - -export const backOutside = { - name: 'noble.backOutside', - from: backPoints, - draft: nobleBackOutside, + macro('vd', { + from: points.shoulder, + to: points.dartTip, + x: points.armhole.x + sa + 15, + id: 'dartPointToShoulder', + }) + macro('vd', { + from: points.armhole, + to: points.waistSide, + x: points.armhole.x + sa + 15, + id: 'sideToArmhole', + }) + macro('vd', { + from: points.shoulder, + to: points.waistSide, + x: points.armhole.x + sa + 25, + id: 'sideToShoulder', + }) + macro('vd', { + from: points.shoulder, + to: points.dartBottomRight, + x: points.armhole.x + sa + 35, + id: 'dartToShoulder', + }) + macro('vd', { + from: points.shoulderDart, + to: points.dartBottomRight, + x: points.armhole.x + sa + 45, + id: 'dartToDart', + }) + + return part + }, } diff --git a/designs/noble/src/backpoints.mjs b/designs/noble/src/backpoints.mjs index 2cdcd5af462..f4fdf616e2a 100644 --- a/designs/noble/src/backpoints.mjs +++ b/designs/noble/src/backpoints.mjs @@ -2,71 +2,69 @@ import { back as bellaBack } from '@freesewing/bella' import { hidePresets } from '@freesewing/core' import * as options from './options.mjs' -function nobleBackPoints({ points, Path, paths, options, snippets, log, part }) { - // Hide Bella paths - for (let key of Object.keys(paths)) paths[key].hide() - for (let i in snippets) delete snippets[i] - - delete points.bustDartLeft - delete points.bustDartLeftCp - - points.shoulderDart = points.hps.shiftFractionTowards( - points.shoulder, - options.shoulderDartPosition - ) - - let aUp = points.dartTip.angle(points.shoulderDart) - let aDown = points.dartBottomRight.angle(points.dartTip) - let aDiff = Math.abs(aUp - aDown) - - // let dartCpAdjustment = Math.abs( options.shoulderDartPosition -.5) +.05 - let dartCpAdjustment = aDiff / 50 - - points.shoulderDartCpUp = points.shoulderDart.shiftFractionTowards( - points.dartTip, - 1 - dartCpAdjustment - ) - points.shoulderDartCpDown = points.shoulderDart.shiftFractionTowards( - points.dartTip, - 1 + dartCpAdjustment - ) - - const length = { - i: new Path() - .move(points.dartBottomLeft) - .curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip) - .curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart) - .length(), - } - - let iteration = 0 - let diff = 0 - let angle = 0 - do { - if (length.o) angle = diff * (length.o > length.i ? -0.1 : 0.1) - - points.dartBottomRight = points.dartBottomRight.rotate(angle, points.waistSide) - - length.o = new Path() - .move(points.shoulderDart) - .curve(points.shoulderDart, points.shoulderDartCpUp, points.dartTip) - .curve(points.shoulderDartCpDown, points.dartRightCp, points.dartBottomRight) - .length() - - diff = length.o - length.i - iteration++ - } while (diff < -0.5 || (diff > 0.5 && iteration < 100)) - if (iteration >= 100) { - log.error('Something is not quite right here!') - } - - return part -} - export const backPoints = { name: 'noble.backPoints', from: bellaBack, hide: hidePresets.HIDE_ALL, options, - draft: nobleBackPoints, + draft: ({ points, Path, paths, options, snippets, log, part }) => { + // Hide Bella paths + for (const key of Object.keys(paths)) paths[key].hide() + for (const i in snippets) delete snippets[i] + + delete points.bustDartLeft + delete points.bustDartLeftCp + + points.shoulderDart = points.hps.shiftFractionTowards( + points.shoulder, + options.shoulderDartPosition + ) + + const aUp = points.dartTip.angle(points.shoulderDart) + const aDown = points.dartBottomRight.angle(points.dartTip) + const aDiff = Math.abs(aUp - aDown) + + // let dartCpAdjustment = Math.abs( options.shoulderDartPosition -.5) +.05 + const dartCpAdjustment = aDiff / 50 + + points.shoulderDartCpUp = points.shoulderDart.shiftFractionTowards( + points.dartTip, + 1 - dartCpAdjustment + ) + points.shoulderDartCpDown = points.shoulderDart.shiftFractionTowards( + points.dartTip, + 1 + dartCpAdjustment + ) + + const length = { + i: new Path() + .move(points.dartBottomLeft) + .curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip) + .curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart) + .length(), + } + + let iteration = 0 + let diff = 0 + let angle = 0 + do { + if (length.o) angle = diff * (length.o > length.i ? -0.1 : 0.1) + + points.dartBottomRight = points.dartBottomRight.rotate(angle, points.waistSide) + + length.o = new Path() + .move(points.shoulderDart) + .curve(points.shoulderDart, points.shoulderDartCpUp, points.dartTip) + .curve(points.shoulderDartCpDown, points.dartRightCp, points.dartBottomRight) + .length() + + diff = length.o - length.i + iteration++ + } while (diff < -0.5 || (diff > 0.5 && iteration < 100)) + if (iteration >= 100) { + log.error('Something is not quite right here!') + } + + return part + }, } diff --git a/designs/noble/src/frontinside.mjs b/designs/noble/src/frontinside.mjs index 9ca77269a84..149adfab83c 100644 --- a/designs/noble/src/frontinside.mjs +++ b/designs/noble/src/frontinside.mjs @@ -1,102 +1,94 @@ import { frontPoints } from './frontpoints.mjs' -function nobleFrontInside({ - store, - sa, - Point, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - delete points.waistDartHem - delete points.waistDartRight - delete points.waistDartRightCp - delete points.waistDartCpBottom - delete points.bustDartBottom - delete points.bustDartCpBottom - delete points.bustDartTip - delete points.bustDartTop - delete points.shoulderDartTipCpDownOutside - delete points.ex - delete points.bustB - delete points.shoulder - delete points.shoulderDartShoulder - delete points.shoulderDartOutside - delete points.pitchMax - delete points.armholeCpTarget - delete points.armholePitch - delete points.armholePitchCp1 - delete points.armholePitchCp2 - delete points.armhole - delete points.armholeCp2 - delete points.bustDartCpTop - delete points.bustSide - delete points.bustDartMiddle - delete points.bustDartEdge +export const frontInside = { + name: 'noble.frontInside', + from: frontPoints, + draft: ({ store, sa, Point, points, Path, paths, Snippet, snippets, options, macro, part }) => { + delete points.waistDartHem + delete points.waistDartRight + delete points.waistDartRightCp + delete points.waistDartCpBottom + delete points.bustDartBottom + delete points.bustDartCpBottom + delete points.bustDartTip + delete points.bustDartTop + delete points.shoulderDartTipCpDownOutside + delete points.ex + delete points.bustB + delete points.shoulder + delete points.shoulderDartShoulder + delete points.shoulderDartOutside + delete points.pitchMax + delete points.armholeCpTarget + delete points.armholePitch + delete points.armholePitchCp1 + delete points.armholePitchCp2 + delete points.armhole + delete points.armholeCp2 + delete points.bustDartCpTop + delete points.bustSide + delete points.bustDartMiddle + delete points.bustDartEdge - if (options.dartPosition == 'shoulder') { - paths.insideSeam = new Path() - .move(points.cfHem) - .line(points.waistDartLeft) - .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) - .line(points.shoulderDartInside) - .line(points.hps) - .curve(points.hpsCp2, points.cfNeckCp1, points.cfNeck) - - paths.seam = paths.insideSeam - .join(new Path().move(points.cfNeck).line(points.cfHem)) - .close() - .attr('class', 'fabric') - - store.set( - 'shoulderDartTipNotch', - new Path() - .move(points.waistDartLeft) + if (options.dartPosition == 'shoulder') { + paths.insideSeam = new Path() + .move(points.cfHem) + .line(points.waistDartLeft) .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) - .length() - ) - } else { - paths.insideSeam = new Path() - .move(points.cfHem) - .line(points.waistDartLeft) - .curve(points.waistDartLeftCp, points.armholeDartTipCpDownInside, points.armholeDartTipInside) - .curve(points.waistCircleInsideCp1, points.armholeCircleInsideCp1, points.armholeDartInside) - .join(paths.armholeInside) - .line(points.hps) - .curve(points.hpsCp2, points.cfNeckCp1, points.cfNeck) + .line(points.shoulderDartInside) + .line(points.hps) + .curve(points.hpsCp2, points.cfNeckCp1, points.cfNeck) - paths.seam = paths.insideSeam - .join(new Path().move(points.cfNeck).line(points.cfHem)) - .close() - .attr('class', 'fabric') + paths.seam = paths.insideSeam + .join(new Path().move(points.cfNeck).line(points.cfHem)) + .close() + .attr('class', 'fabric') - store.set( - 'shoulderDartTipNotch', - new Path() - .move(points.waistDartLeft) + store.set( + 'shoulderDartTipNotch', + new Path() + .move(points.waistDartLeft) + .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) + .length() + ) + } else { + paths.insideSeam = new Path() + .move(points.cfHem) + .line(points.waistDartLeft) .curve( points.waistDartLeftCp, points.armholeDartTipCpDownInside, points.armholeDartTipInside ) - .length() - ) - } + .curve(points.waistCircleInsideCp1, points.armholeCircleInsideCp1, points.armholeDartInside) + .join(paths.armholeInside) + .line(points.hps) + .curve(points.hpsCp2, points.cfNeckCp1, points.cfNeck) - macro('cutonfold', { - from: points.cfNeck, - to: points.cfHem, - grainline: true, - }) + paths.seam = paths.insideSeam + .join(new Path().move(points.cfNeck).line(points.cfHem)) + .close() + .attr('class', 'fabric') + + store.set( + 'shoulderDartTipNotch', + new Path() + .move(points.waistDartLeft) + .curve( + points.waistDartLeftCp, + points.armholeDartTipCpDownInside, + points.armholeDartTipInside + ) + .length() + ) + } + + macro('cutonfold', { + from: points.cfNeck, + to: points.cfHem, + grainline: true, + }) - if (complete) { if (options.dartPosition == 'shoulder') { snippets.shoulderDartTip = new Snippet('notch', points.shoulderDartTip) } else { @@ -106,8 +98,10 @@ function nobleFrontInside({ macro('title', { at: points.titleAnchor, nr: 1, - title: 'Inside Front', + title: 'frontInside', }) + points.gridAnchor = points.hps.clone() + points.scaleboxAnchor = points.titleAnchor.shift(-90, 90).shift(0, 10) macro('scalebox', { at: points.scaleboxAnchor, rotate: 270 }) @@ -116,81 +110,97 @@ function nobleFrontInside({ paths.sa = paths.sa.move(points.cfHem).line(paths.sa.start()) } - if (paperless) { - let extraOffset = 0 - if (options.dartPosition == 'shoulder') { - macro('hd', { - from: points.cfNeck, - to: points.shoulderDartInside, - y: points.hps.y - 25, - }) - macro('vd', { - from: points.cfHem, - to: points.shoulderDartInside, - x: 0 - 30, - }) - } else { - extraOffset = 10 - macro('hd', { - from: points.cfNeck, - to: points.shoulderCp1, - y: points.hps.y - 35, - }) - macro('hd', { - from: points.cfNeck, - to: points.armholeDartInsideCp2, - y: points.hps.y - 25, - }) - macro('vd', { - from: points.cfHem, - to: points.armholeDartInsideCp2, - x: 0 - 20, - }) - macro('vd', { - from: points.cfHem, - to: points.shoulderCp1, - x: 0 - 40, - }) - } - + let extraOffset = 0 + if (options.dartPosition == 'shoulder') { + macro('hd', { + from: points.cfNeck, + to: points.shoulderDartInside, + y: points.hps.y - 25, + id: 'hpsToDart', + }) + macro('vd', { + from: points.cfHem, + to: points.shoulderDartInside, + x: 0 - 30, + id: 'hemToDart', + }) + macro('vd', { + from: points.cfHem, + to: points.shoulderDartTip, + x: 0 - 10, + id: 'hemToDartTip', + }) + macro('hd', { + from: points.cfBust, + to: points.shoulderDartTip, + y: points.cfHem.y + sa + 25, + id: 'middleToDartTip', + }) + } else { + extraOffset = 10 + macro('hd', { + from: points.hps, + to: points.shoulderCp1, + y: points.hps.y - 35, + id: 'hpsToShoulder', + }) + macro('hd', { + from: points.hps, + to: points.armholeDartInsideCp2, + y: points.hps.y - 25, + id: 'hpsToDart', + }) + macro('vd', { + from: points.cfHem, + to: points.armholeDartInsideCp2, + x: 0 - 20, + id: 'hemToDart', + }) + macro('vd', { + from: points.cfHem, + to: points.shoulderCp1, + x: 0 - 40, + id: 'hemToShoulder', + }) macro('vd', { from: points.cfHem, to: points.armholeDartTipInside, x: 0 - 10, - }) - macro('vd', { - from: points.cfHem, - to: points.cfNeck, - x: 0 - 20 - extraOffset, - }) - macro('vd', { - from: points.cfHem, - to: points.hps, - x: 0 - 40 - extraOffset, + id: 'hemToDartTip', }) macro('hd', { from: points.cfBust, to: points.armholeDartTipInside, y: points.cfHem.y + sa + 25, - }) - macro('hd', { - from: points.cfHem, - to: points.waistDartLeft, - y: points.cfHem.y + sa + 15, - }) - macro('hd', { - from: points.cfNeck, - to: points.hps, - y: points.hps.y - sa - 15, + id: 'middleToDartTip', }) } - } - return part -} + macro('vd', { + from: points.cfHem, + to: points.cfNeck, + x: 0 - 20 - extraOffset, + id: 'hemToNeck', + }) + macro('vd', { + from: points.cfHem, + to: points.hps, + x: 0 - 40 - extraOffset, + id: 'hemToHps', + }) + macro('hd', { + from: points.cfHem, + to: points.waistDartLeft, + y: points.cfHem.y + sa + 15, + id: 'middleToDart', + }) + macro('hd', { + from: points.cfNeck, + to: points.hps, + y: points.hps.y - sa - 15, + id: 'middleToHps', + }) -export const frontInside = { - name: 'noble.frontInside', - from: frontPoints, - draft: nobleFrontInside, + return part + }, } diff --git a/designs/noble/src/frontoutside.mjs b/designs/noble/src/frontoutside.mjs index 993c37482e3..be39115b46d 100644 --- a/designs/noble/src/frontoutside.mjs +++ b/designs/noble/src/frontoutside.mjs @@ -1,82 +1,77 @@ import { frontPoints } from './frontpoints.mjs' import { frontInside } from './frontinside.mjs' -function nobleFrontOutside({ - store, - sa, - points, - Path, - paths, - Snippet, - snippets, - options, - complete, - paperless, - macro, - part, -}) { - delete points.bustDartTop - delete points.bustSide - delete points.bustDartMiddle - delete points.bustDartBottom - delete points.bustDartCpBottom - delete points.bustB - delete points.bustDartEdge - macro('cutonfold', false) +export const frontOutside = { + name: 'noble.frontOutside', + from: frontPoints, + after: frontInside, + draft: ({ store, sa, points, Path, paths, Snippet, snippets, options, macro, part }) => { + delete points.bustDartTop + delete points.bustSide + delete points.bustDartMiddle + delete points.bustDartBottom + delete points.bustDartCpBottom + delete points.bustB + delete points.bustDartEdge - if (options.dartPosition == 'shoulder') { - paths.princessSeam = new Path() - .move(points.shoulderDartOutside) - .curve( - points.shoulderDartTipCpDownOutside, - points.waistUpDartRightCpUp, - points.waistUpDartRight - ) - .curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight) - .hide() - paths.armhole = new Path() - .move(points.armhole) - .curve(points.armholeCp2, points.armholePitchCp1, points.armholePitch) - .curve_(points.armholePitchCp2, points.shoulder) - .hide() + macro('rmcutonfold') - paths.seam = new Path() - .move(points.waistDartRight) - .line(points.sideHem) - .line(points.armhole) - .join(paths.armhole) - .line(points.shoulderDartOutside) - .join(paths.princessSeam) - .close() - .attr('class', 'fabric') - } else { - paths.princessSeam = new Path() - .move(points.armholeDartOutside) - .curve(points.armholeCircleOutsideCp1, points.waistCircleOutsideCp1, points.waistUpDartRight) - .curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight) - .hide() + if (options.dartPosition == 'shoulder') { + paths.princessSeam = new Path() + .move(points.shoulderDartOutside) + .curve( + points.shoulderDartTipCpDownOutside, + points.waistUpDartRightCpUp, + points.waistUpDartRight + ) + .curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight) + .hide() + paths.armhole = new Path() + .move(points.armhole) + .curve(points.armholeCp2, points.armholePitchCp1, points.armholePitch) + .curve_(points.armholePitchCp2, points.shoulder) + .hide() - paths.seam = new Path() - .move(points.waistDartRight) - .line(points.sideHem) - .line(points.armhole) - .join(paths.armholeOutside.reverse()) - .join(paths.princessSeam) - .close() - .attr('class', 'fabric') - } + paths.seam = new Path() + .move(points.waistDartRight) + .line(points.sideHem) + .line(points.armhole) + .join(paths.armhole) + .line(points.shoulderDartOutside) + .join(paths.princessSeam) + .close() + .attr('class', 'fabric') + } else { + paths.princessSeam = new Path() + .move(points.armholeDartOutside) + .curve( + points.armholeCircleOutsideCp1, + points.waistCircleOutsideCp1, + points.waistUpDartRight + ) + .curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight) + .hide() - points.grainTop = points.armhole.shift(225, 20) - points.grainBottom = points.sideHemInitial.shift(135, 20) - macro('grainline', { - from: points.grainBottom, - to: points.grainTop, - }) + paths.seam = new Path() + .move(points.waistDartRight) + .line(points.sideHem) + .line(points.armhole) + .join(paths.armholeOutside.reverse()) + .join(paths.princessSeam) + .close() + .attr('class', 'fabric') + } - store.cutlist.removeCut() - store.cutlist.addCut() + points.grainTop = points.armhole.shift(225, 20) + points.grainBottom = points.sideHemInitial.shift(135, 20) + macro('grainline', { + from: points.grainBottom, + to: points.grainTop, + }) + + store.cutlist.removeCut() + store.cutlist.addCut() - if (complete) { points.snippet = paths.princessSeam.shiftAlong( paths.princessSeam.length() - store.get('shoulderDartTipNotch') ) @@ -88,140 +83,154 @@ function nobleFrontOutside({ macro('title', { at: points.titleAnchor, nr: 2, - title: 'Outside Front', + title: 'frontOutside', }) + points.gridAnchor = points.armholeCpTarget.clone() if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') - if (paperless) { - let pLeft = paths.princessSeam.edge('left') + let pLeft = paths.princessSeam.edge('left') + macro('hd', { + from: points.waistDartRight, + to: points.armholeOutsidePitchCp1, + y: points.sideHemInitial.y + sa + 35, + id: 'dartToArmhole', + }) + macro('hd', { + from: points.waistDartRight, + to: points.sideHemInitial, + y: points.sideHemInitial.y + sa + 25, + id: 'dartToSide', + }) + macro('hd', { + from: pLeft, + to: points.sideHemInitial, + y: points.sideHemInitial.y + sa + 15, + id: 'leftToSide', + }) + + macro('vd', { + from: points.armholeOutsidePitchCp1, + to: points.sideHemInitial, + x: points.sideHemInitial.x + sa + 15, + id: 'hemToArmhole', + }) + macro('vd', { + from: points.waistDartRight, + to: pLeft, + x: pLeft.x - sa - 15, + id: 'hemToLeft', + }) + + if (options.dartPosition == 'shoulder') { macro('hd', { - from: points.waistDartRight, - to: points.armholeOutsidePitchCp1, - y: points.sideHemInitial.y + sa + 35, + from: points.shoulderDartOutside, + to: points.shoulder, + y: points.shoulderDartOutside.y - sa - 15, + id: 'dartToShoulder', }) macro('hd', { - from: points.waistDartRight, - to: points.sideHemInitial, - y: points.sideHemInitial.y + sa + 25, + from: points.snippet, + to: points.shoulder, + y: points.shoulderDartOutside.y - sa - 25, + id: 'dartPointToShoulder', }) macro('hd', { from: pLeft, - to: points.sideHemInitial, - y: points.sideHemInitial.y + sa + 15, + to: points.shoulder, + y: points.shoulderDartOutside.y - sa - 35, + id: 'leftToShoulder', + }) + macro('hd', { + from: points.waistDartRight, + to: points.shoulder, + y: points.sideHemInitial.y + sa + 45, + id: 'hemDartToShoulder', }) - macro('vd', { - from: points.armholeOutsidePitchCp1, + from: points.shoulder, to: points.sideHemInitial, - x: points.sideHemInitial.x + sa + 15, + x: points.shoulder.x, + id: 'hemToShoulder', + }) + macro('vd', { + from: points.shoulderDartOutside, + to: points.sideHemInitial, + x: points.shoulderDartOutside.x, + id: 'sideHemToShoulderDart', }) macro('vd', { from: points.waistDartRight, - to: pLeft, + to: points.shoulderDartOutside, + x: pLeft.x - sa - 25, + id: 'hemToShoulderDart', + }) + macro('vd', { + from: points.snippet, + to: points.shoulderDartOutside, x: pLeft.x - sa - 15, + id: 'shoulderDartToDartPoint', }) - if (options.dartPosition == 'shoulder') { - macro('hd', { - from: points.shoulderDartOutside, - to: points.shoulder, - y: points.shoulderDartOutside.y - sa - 15, - }) - macro('hd', { - from: points.snippet, - to: points.shoulder, - y: points.shoulderDartOutside.y - sa - 25, - }) - macro('hd', { - from: pLeft, - to: points.shoulder, - y: points.shoulderDartOutside.y - sa - 35, - }) - macro('hd', { - from: points.waistDartRight, - to: points.shoulder, - y: points.sideHemInitial.y + sa + 45, - }) - macro('vd', { - from: points.shoulder, - to: points.sideHemInitial, - x: points.shoulder.x, //+sa + 15, - }) - macro('vd', { - from: points.shoulderDartOutside, - to: points.sideHemInitial, - x: points.shoulder.x + sa + 15, - }) - macro('vd', { - from: points.waistDartRight, - to: points.shoulderDartOutside, - x: pLeft.x - sa - 25, - }) - macro('vd', { - from: points.snippet, - to: points.shoulderDartOutside, - x: pLeft.x - sa - 15, - }) - - let pArmholeLeft = paths.armhole.edge('left') - macro('hd', { - from: points.waistDartRight, - to: pArmholeLeft, - y: points.sideHemInitial.y + sa + 5, - }) - macro('vd', { - from: pArmholeLeft, - to: points.sideHemInitial, - x: points.sideHemInitial.x + sa + 25, - }) - } else { - let pTop = paths.princessSeam.edge('top') - macro('hd', { - from: pLeft, - to: points.armholeOutsidePitchCp1, - y: pTop.y - sa - 35, - }) - macro('hd', { - from: pLeft, - to: points.armholeDartOutside, - y: pTop.y - sa - 25, - }) - macro('hd', { - from: pLeft, - to: pTop, - y: pTop.y - sa - 15, - }) - macro('vd', { - from: points.waistDartRight, - to: pTop, - x: pLeft.x - sa - 25, - }) - macro('vd', { - from: points.snippet, - to: pTop, - x: pLeft.x - sa - 15, - }) - macro('vd', { - from: points.armholeDartOutside, - to: points.sideHemInitial, - x: points.sideHemInitial.x + sa + 25, - }) - macro('vd', { - from: pTop, - to: points.sideHemInitial, - x: points.sideHemInitial.x + sa + 35, - }) - } + const pArmholeLeft = paths.armhole.edge('left') + macro('hd', { + from: points.waistDartRight, + to: pArmholeLeft, + y: points.sideHemInitial.y + sa + 5, + id: 'hemDartToRight', + }) + macro('vd', { + from: pArmholeLeft, + to: points.sideHemInitial, + x: points.sideHemInitial.x + sa + 25, + id: 'hemSideToRight', + }) + } else { + let pTop = paths.princessSeam.edge('top') + macro('hd', { + from: pLeft, + to: points.armholeOutsidePitchCp1, + y: pTop.y - sa - 35, + id: 'leftToArmhole', + }) + macro('hd', { + from: pLeft, + to: points.armholeDartOutside, + y: pTop.y - sa - 25, + id: 'leftToArmholeDart', + }) + macro('hd', { + from: pLeft, + to: pTop, + y: pTop.y - sa - 15, + id: 'leftToTop', + }) + macro('vd', { + from: points.waistDartRight, + to: pTop, + x: pLeft.x - sa - 25, + id: 'hemToTop', + }) + macro('vd', { + from: points.snippet, + to: pTop, + x: pLeft.x - sa - 15, + id: 'topToDartPoint', + }) + macro('vd', { + from: points.armholeDartOutside, + to: points.sideHemInitial, + x: points.sideHemInitial.x + sa + 25, + id: 'sideHemToArmholeDart', + }) + macro('vd', { + from: pTop, + to: points.sideHemInitial, + x: points.sideHemInitial.x + sa + 35, + id: 'sideHemToTop', + }) } - } - return part -} - -export const frontOutside = { - name: 'noble.frontOutside', - from: frontPoints, - after: frontInside, - draft: nobleFrontOutside, + return part + }, } diff --git a/designs/noble/src/frontpoints.mjs b/designs/noble/src/frontpoints.mjs index 16a2bcd182c..d7cc8195f7c 100644 --- a/designs/noble/src/frontpoints.mjs +++ b/designs/noble/src/frontpoints.mjs @@ -2,324 +2,329 @@ import { frontSideDart as bellaFront } from '@freesewing/bella' import { hidePresets } from '@freesewing/core' import * as options from './options.mjs' -function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro, part }) { - const bCircle = 0.552284749831 - - // Hide Bella paths - for (let key of Object.keys(paths)) paths[key].hide() - for (let i in snippets) delete snippets[i] - - // Remove macros from Bella - macro('title', false) - macro('scalebox', false) - - points.shoulderDartInside = points.hps.shiftFractionTowards( - points.shoulder, - options.dartPosition == 'shoulder' ? options.shoulderDartPosition : 0.5 - ) - points.orgShoulder = points.shoulder.clone() - points.orgArmhole = points.armhole.clone() - points.orgArmholeCp2 = points.armholeCp2.clone() - points.orgArmholePitch = points.armholePitch.clone() - points.orgArmholePitchCp1 = points.armholePitchCp1.clone() - points.orgArmholePitchCp2 = points.armholePitchCp2.clone() - let armholePath = new Path() - .move(points.shoulder) - ._curve(points.armholePitchCp2, points.armholePitch) - .curve(points.armholePitchCp1, points.armholeCp2, points.armhole) - - points.armholeDartInside = armholePath.shiftFractionAlong(options.armholeDartPosition) - points.armholeDartOutside = points.armholeDartInside.clone() - - let armholePaths = armholePath.split(points.armholeDartInside) - - let armholePathInside = armholePaths[0].clone().hide() - let armholePathOutside = armholePaths[1].clone().hide() - let armholeDartAngle = - armholePathInside.reverse().shiftAlong(1).angle(armholePathOutside.shiftAlong(1)) - 90 - - points.armholeDartArmhole = points.armholeDartInside.shiftFractionTowards( - points.armholeDartOutside, - 0.5 - ) - points.armholeDartTip = points.armholeDartArmhole.shiftFractionTowards( - points.bust, - options.upperDartLength - ) - - points.armholeCircleInsideCp1 = points.armholeDartInside.shift( - armholeDartAngle, - bCircle * points.armholeDartInside.dist(points.armholeDartTip) - ) - points.armholeCircleOutsideCp1 = points.armholeCircleInsideCp1.clone() - - points.shoulderCp1 = armholePathInside.ops[1].cp1.clone() - points.armholeInsidePitch = armholePathInside.ops[1].to.clone() - points.armholeInsidePitchCp2 = armholePathInside.ops[1].cp2.clone() - if (armholePathInside.ops.length == 2) { - points.armholeInsidePitchCp1 = points.armholeDartInside.clone() - points.armholeDartInsideCp2 = points.armholeDartInside.clone() - } else { - points.armholeInsidePitchCp1 = armholePathInside.ops[2].cp1.clone() - points.armholeDartInsideCp2 = armholePathInside.ops[2].cp2.clone() - } - points.armholeDartOutsideCp1 = armholePathOutside.ops[1].cp1.clone() - points.armholeOutsidePitch = armholePathOutside.ops[1].to.clone() - points.armholeOutsidePitchCp2 = armholePathOutside.ops[1].cp2.clone() - if (armholePathOutside.ops.length == 2) { - points.armholeOutsidePitchCp1 = points.armhole.clone() - points.armholeCp2 = points.armhole.clone() - } else { - points.armholeOutsidePitchCp1 = armholePathOutside.ops[2].cp1.clone() - points.armholeCp2 = armholePathOutside.ops[2].cp2.clone() - } - - if (points.armholeDartInside.sitsRoughlyOn(points.armholeInsidePitch)) { - paths.armholeInside = new Path() - .move(points.armholeDartInside) - .curve(points.armholeInsidePitchCp2, points.shoulderCp1, points.shoulder) - .hide() - } else { - paths.armholeInside = new Path() - .move(points.armholeDartInside) - .curve(points.armholeDartInsideCp2, points.armholeInsidePitchCp1, points.armholeInsidePitch) - .curve(points.armholeInsidePitchCp2, points.shoulderCp1, points.shoulder) - .hide() - } - - let rotateAngle = - points.shoulderDartInside.angle(points.bustA) - points.bustDartTop.angle(points.bustA) - if (rotateAngle < 0) { - rotateAngle += 360 - } - if (rotateAngle > 360) { - rotateAngle -= 360 - } - - points.shoulderDartCpTop = points.bustDartCpTop.rotate(rotateAngle, points.bustA) - points.shoulderDartCpBottom = points.bustDartCpBottom.rotate(rotateAngle, points.bustA) - - rotateAngle = - points.armholeDartInside.angle(points.bustA) - points.bustDartTop.angle(points.bustA) - if (rotateAngle < 0) { - rotateAngle += 360 - } - if (rotateAngle > 360) { - rotateAngle -= 360 - } - - points.armholeDartCpTop = points.bustDartCpTop.rotate(rotateAngle, points.bustA) - points.armholeDartCpBottom = points.bustDartCpBottom.rotate(rotateAngle, points.bustA) - - let spreadAngle = - /*360 -*/ points.bustA.angle(points.bustDartBottom) - points.bustA.angle(points.bustDartTop) - - points.shoulderDartOutside = points.shoulderDartInside.rotate(spreadAngle, points.bustA) - points.shoulderDartShoulder = points.shoulderDartInside.shiftFractionTowards( - points.shoulderDartOutside, - 0.5 - ) - - points.shoulderDartTip = points.shoulderDartShoulder.shiftFractionTowards( - points.bust, - options.upperDartLength - ) - let dartRatio = - new Path().move(points.waistDartHem).line(points.waistDartTip).length() / - new Path().move(points.shoulderDartShoulder).line(points.shoulderDartTip).length() - - points.shoulder = points.shoulder.rotate(spreadAngle, points.bustA) - points.armhole = points.armhole.rotate(spreadAngle, points.bustA) - points.armholeCp2 = points.armholeCp2.rotate(spreadAngle, points.bustA) - points.armholePitch = points.armholePitch.rotate(spreadAngle, points.bustA) - points.armholePitchCp1 = points.armholePitchCp1.rotate(spreadAngle, points.bustA) - points.armholePitchCp2 = points.armholePitchCp2.rotate(spreadAngle, points.bustA) - points.armholeCircleOutsideCp1 = points.armholeCircleOutsideCp1.rotate(spreadAngle, points.bustA) - points.armholeDartOutside = points.armholeDartOutside.rotate(spreadAngle, points.bustA) - points.armholeDartOutsideCp1 = points.armholeDartOutsideCp1.rotate(spreadAngle, points.bustA) - points.armholeOutsidePitchCp2 = points.armholeOutsidePitchCp2.rotate(spreadAngle, points.bustA) - points.armholeOutsidePitch = points.armholeOutsidePitch.rotate(spreadAngle, points.bustA) - points.armholeOutsidePitchCp1 = points.armholeOutsidePitchCp1.rotate(spreadAngle, points.bustA) - - if (points.armhole.sitsRoughlyOn(points.armholeOutsidePitch)) { - paths.armholeOutside = new Path() - .move(points.armholeDartOutside) - .curve(points.armholeDartOutsideCp1, points.armholeOutsidePitchCp2, points.armhole) - .hide() - } else { - paths.armholeOutside = new Path() - .move(points.armholeDartOutside) - .curve( - points.armholeDartOutsideCp1, - points.armholeOutsidePitchCp2, - points.armholeOutsidePitch - ) - .curve(points.armholeOutsidePitchCp1, points.armholeCp2, points.armhole) - .hide() - } - - paths.armholeTempDart = new Path() - .move(points.armholeDartOutside) - ._curve(points.armholeDartCpBottom, points.armholeDartTip) - .curve_(points.armholeDartCpTop, points.armholeDartInside) - .hide() - - points.shoulderDartTipCpDownOutside = points.shoulderDartOutside.shiftFractionTowards( - points.bust, - 1 + (1 - options.upperDartLength) + (1 - options.waistDartLength) * dartRatio - ) - // points.shoulderDartTipCpDownOutside = points.shoulderDartTipCpDownOutside.rotate( options.dartOutsideCP *10, points.shoulderDartOutside ) - - points.shoulderDartTipCpDownInside = points.shoulderDartInside.shiftFractionTowards( - points.shoulderDartTip, - 1 + (1 - options.upperDartLength) + (1 - options.waistDartLength) * dartRatio - ) - points.armholeDartTipCpDownInside = points.armholeDartTip.shiftFractionTowards( - // points.waistDartHem, - points.waistDartLeft, - 1 - options.upperDartLength + (1 - options.waistDartLength) * dartRatio - ) - - points.bustAcp = points.waistDartRight.shiftOutwards(points.bustA, 10) - - paths.shoulderInsideSeam = new Path() - .move(points.waistDartLeft) - .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) - .line(points.shoulderDartInside) - .hide() - - paths.armholeInsideSeam = new Path() - .move(points.waistDartLeft) - .curve(points.waistDartLeftCp, points.armholeDartTipCpDownInside, points.armholeDartTip) - .hide() - - paths.sOutsideSeam = new Path() - .move(points.waistDartRight) - .curve(points.bustAcp, points.shoulderDartTipCpDownOutside, points.shoulderDartOutside) - .hide() - - points.waistDartRightCp = points.bustAcp.clone() - - let shoulderInsideSeam = new Path() - .move(points.waistDartLeft) - .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) - .line(points.shoulderDartInside) - .hide() - - points.waistUpDartLeft = paths.armholeInsideSeam.shiftAlong( - points.waistDartLeft.dist(points.armholeDartTip) * 0.5 - ) - points.waistCircleInsideCp1 = points.waistUpDartLeft.shiftTowards( - points.waistDartLeft, - -0.5 * bCircle * points.armholeDartOutside.dist(points.armholeDartTip) - ) - points.shoulderDartTipCpDownOutside = points.shoulderDartTipCpDownOutside - .rotate(-2.5, points.shoulderDartOutside) - .shiftFractionTowards(points.shoulderDartOutside, 0.2) - - let iteration = 1 - let diff = 0 - do { - points.waistDartRight = points.waistDartRight.rotate(diff * 0.1, points.sideHemInitial) - - let outsideSeam = new Path() - .move(points.waistDartRight) - .curve(points.bustAcp, points.shoulderDartTipCpDownOutside, points.shoulderDartOutside) - - points.waistUpDartRight = outsideSeam.shiftAlong( - points.waistDartRight.dist(points.waistDartRightCp) * 0.5 - ) - points.waistUpDartRightCpDown = points.waistUpDartRight.shiftFractionTowards( - points.waistDartRight, - 0.25 - ) - // points.waistUpDartRightCpUp = points.waistUpDartRight.shiftFractionTowards( points.waistDartRight, -.25 ) - points.waistUpDartRightCpUp = points.waistUpDartRight.shiftFractionTowards( - points.waistDartRight, - -0.6 - ) - points.waistCpUp = points.waistDartRight - .shiftTowards( - points.sideHemInitial, - points.waistDartRight.dist(points.waistUpDartRight) * 0.25 - ) - .rotate(90, points.waistDartRight) - points.waistCircleInsideCp1 = points.armholeDartTip.shiftTowards( - points.armholeDartTipCpDownInside, - -0.5 * bCircle * points.armholeDartInside.dist(points.armholeDartTip) - ) - - outsideSeam = new Path() - .move(points.waistDartRight) - .curve(points.waistCpUp, points.waistUpDartRightCpDown, points.waistUpDartRight) - .curve( - points.waistUpDartRightCpUp, - points.shoulderDartTipCpDownOutside, - points.shoulderDartOutside - ) - - diff = shoulderInsideSeam.length() - outsideSeam.length() - iteration++ - } while ((diff > 1 || diff < -1) && iteration < 200) - if (iteration >= 200) { - log.error('Something is not quite right here!') - } - points.waistDartRightCp = points.bustAcp.clone() - points.armholeDartTipInside = points.armholeDartTip.clone() - points.waistCircleOutsideCp1 = points.waistUpDartRight.shiftTowards( - points.waistDartRight, - -1 * bCircle * points.armholeDartOutside.dist(points.armholeDartTip) - ) - - diff = 0 - iteration = 0 - do { - let dist = points.armholeDartTipInside.dist(points.armholeDartTipCpDownInside) - if (points.armholeDartTipInside.x > points.waistCircleOutsideCp1) { - points.armholeDartTipInside.x = points.armholeDartTipInside.x - 0.5 - points.armholeDartTipInside.y = points.armholeDartTipInside.y + 0.5 - } else { - points.waistCircleOutsideCp1 = points.waistCircleOutsideCp1.shiftTowards( - points.waistUpDartRight, - diff > 0 ? 1 : -1 - ) - } - points.armholeDartTipCpDownInside = points.waistCircleInsideCp1.shiftOutwards( - points.armholeDartTipInside, - dist - ) - - paths.armholeTempCircleOutside = new Path() - .move(points.armholeDartOutside) - .curve(points.armholeCircleOutsideCp1, points.waistCircleOutsideCp1, points.waistUpDartRight) - .curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight) - .hide() - .attr('class', 'lining') - paths.armholeTempCircleInside = new Path() - .move(points.armholeDartInside) - .curve( - points.armholeCircleInsideCp1, - points.waistCircleInsideCp1, - points.armholeDartTipInside - ) - .curve(points.armholeDartTipCpDownInside, points.waistDartLeftCp, points.waistDartLeft) - .hide() - .attr('class', 'lining') - - diff = paths.armholeTempCircleOutside.length() - paths.armholeTempCircleInside.length() - iteration++ - } while ((diff < -1 || diff > 1) && iteration < 200) - if (iteration >= 200) { - log.error('Something is not quite right here!') - } - - return part -} - export const frontPoints = { name: 'noble.frontPoints', from: bellaFront, hide: hidePresets.HIDE_ALL, options, - draft: nobleFrontPoints, + draft: ({ log, points, Path, paths, snippets, options, macro, part }) => { + const bCircle = 0.552284749831 + + // Hide Bella paths + for (const key of Object.keys(paths)) paths[key].hide() + for (const i in snippets) delete snippets[i] + + // Remove macros from Bella + macro('rmtitle') + macro('rmscalebox') + + points.shoulderDartInside = points.hps.shiftFractionTowards( + points.shoulder, + options.dartPosition == 'shoulder' ? options.shoulderDartPosition : 0.5 + ) + points.orgShoulder = points.shoulder.clone() + points.orgArmhole = points.armhole.clone() + points.orgArmholeCp2 = points.armholeCp2.clone() + points.orgArmholePitch = points.armholePitch.clone() + points.orgArmholePitchCp1 = points.armholePitchCp1.clone() + points.orgArmholePitchCp2 = points.armholePitchCp2.clone() + const armholePath = new Path() + .move(points.shoulder) + ._curve(points.armholePitchCp2, points.armholePitch) + .curve(points.armholePitchCp1, points.armholeCp2, points.armhole) + + points.armholeDartInside = armholePath.shiftFractionAlong(options.armholeDartPosition) + points.armholeDartOutside = points.armholeDartInside.clone() + + const armholePaths = armholePath.split(points.armholeDartInside) + + const armholePathInside = armholePaths[0].clone().hide() + const armholePathOutside = armholePaths[1].clone().hide() + const armholeDartAngle = + armholePathInside.reverse().shiftAlong(1).angle(armholePathOutside.shiftAlong(1)) - 90 + + points.armholeDartArmhole = points.armholeDartInside.shiftFractionTowards( + points.armholeDartOutside, + 0.5 + ) + points.armholeDartTip = points.armholeDartArmhole.shiftFractionTowards( + points.bust, + options.upperDartLength + ) + + points.armholeCircleInsideCp1 = points.armholeDartInside.shift( + armholeDartAngle, + bCircle * points.armholeDartInside.dist(points.armholeDartTip) + ) + points.armholeCircleOutsideCp1 = points.armholeCircleInsideCp1.clone() + + points.shoulderCp1 = armholePathInside.ops[1].cp1.clone() + points.armholeInsidePitch = armholePathInside.ops[1].to.clone() + points.armholeInsidePitchCp2 = armholePathInside.ops[1].cp2.clone() + if (armholePathInside.ops.length == 2) { + points.armholeInsidePitchCp1 = points.armholeDartInside.clone() + points.armholeDartInsideCp2 = points.armholeDartInside.clone() + } else { + points.armholeInsidePitchCp1 = armholePathInside.ops[2].cp1.clone() + points.armholeDartInsideCp2 = armholePathInside.ops[2].cp2.clone() + } + points.armholeDartOutsideCp1 = armholePathOutside.ops[1].cp1.clone() + points.armholeOutsidePitch = armholePathOutside.ops[1].to.clone() + points.armholeOutsidePitchCp2 = armholePathOutside.ops[1].cp2.clone() + if (armholePathOutside.ops.length == 2) { + points.armholeOutsidePitchCp1 = points.armhole.clone() + points.armholeCp2 = points.armhole.clone() + } else { + points.armholeOutsidePitchCp1 = armholePathOutside.ops[2].cp1.clone() + points.armholeCp2 = armholePathOutside.ops[2].cp2.clone() + } + + if (points.armholeDartInside.sitsRoughlyOn(points.armholeInsidePitch)) { + paths.armholeInside = new Path() + .move(points.armholeDartInside) + .curve(points.armholeInsidePitchCp2, points.shoulderCp1, points.shoulder) + .hide() + } else { + paths.armholeInside = new Path() + .move(points.armholeDartInside) + .curve(points.armholeDartInsideCp2, points.armholeInsidePitchCp1, points.armholeInsidePitch) + .curve(points.armholeInsidePitchCp2, points.shoulderCp1, points.shoulder) + .hide() + } + + let rotateAngle = + points.shoulderDartInside.angle(points.bustA) - points.bustDartTop.angle(points.bustA) + if (rotateAngle < 0) { + rotateAngle += 360 + } + if (rotateAngle > 360) { + rotateAngle -= 360 + } + + points.shoulderDartCpTop = points.bustDartCpTop.rotate(rotateAngle, points.bustA) + points.shoulderDartCpBottom = points.bustDartCpBottom.rotate(rotateAngle, points.bustA) + + rotateAngle = + points.armholeDartInside.angle(points.bustA) - points.bustDartTop.angle(points.bustA) + if (rotateAngle < 0) { + rotateAngle += 360 + } + if (rotateAngle > 360) { + rotateAngle -= 360 + } + + points.armholeDartCpTop = points.bustDartCpTop.rotate(rotateAngle, points.bustA) + points.armholeDartCpBottom = points.bustDartCpBottom.rotate(rotateAngle, points.bustA) + + const spreadAngle = + /*360 -*/ points.bustA.angle(points.bustDartBottom) - points.bustA.angle(points.bustDartTop) + + points.shoulderDartOutside = points.shoulderDartInside.rotate(spreadAngle, points.bustA) + points.shoulderDartShoulder = points.shoulderDartInside.shiftFractionTowards( + points.shoulderDartOutside, + 0.5 + ) + + points.shoulderDartTip = points.shoulderDartShoulder.shiftFractionTowards( + points.bust, + options.upperDartLength + ) + const dartRatio = + new Path().move(points.waistDartHem).line(points.waistDartTip).length() / + new Path().move(points.shoulderDartShoulder).line(points.shoulderDartTip).length() + + points.shoulder = points.shoulder.rotate(spreadAngle, points.bustA) + points.armhole = points.armhole.rotate(spreadAngle, points.bustA) + points.armholeCp2 = points.armholeCp2.rotate(spreadAngle, points.bustA) + points.armholePitch = points.armholePitch.rotate(spreadAngle, points.bustA) + points.armholePitchCp1 = points.armholePitchCp1.rotate(spreadAngle, points.bustA) + points.armholePitchCp2 = points.armholePitchCp2.rotate(spreadAngle, points.bustA) + points.armholeCircleOutsideCp1 = points.armholeCircleOutsideCp1.rotate( + spreadAngle, + points.bustA + ) + points.armholeDartOutside = points.armholeDartOutside.rotate(spreadAngle, points.bustA) + points.armholeDartOutsideCp1 = points.armholeDartOutsideCp1.rotate(spreadAngle, points.bustA) + points.armholeOutsidePitchCp2 = points.armholeOutsidePitchCp2.rotate(spreadAngle, points.bustA) + points.armholeOutsidePitch = points.armholeOutsidePitch.rotate(spreadAngle, points.bustA) + points.armholeOutsidePitchCp1 = points.armholeOutsidePitchCp1.rotate(spreadAngle, points.bustA) + + if (points.armhole.sitsRoughlyOn(points.armholeOutsidePitch)) { + paths.armholeOutside = new Path() + .move(points.armholeDartOutside) + .curve(points.armholeDartOutsideCp1, points.armholeOutsidePitchCp2, points.armhole) + .hide() + } else { + paths.armholeOutside = new Path() + .move(points.armholeDartOutside) + .curve( + points.armholeDartOutsideCp1, + points.armholeOutsidePitchCp2, + points.armholeOutsidePitch + ) + .curve(points.armholeOutsidePitchCp1, points.armholeCp2, points.armhole) + .hide() + } + + paths.armholeTempDart = new Path() + .move(points.armholeDartOutside) + ._curve(points.armholeDartCpBottom, points.armholeDartTip) + .curve_(points.armholeDartCpTop, points.armholeDartInside) + .hide() + + points.shoulderDartTipCpDownOutside = points.shoulderDartOutside.shiftFractionTowards( + points.bust, + 1 + (1 - options.upperDartLength) + (1 - options.waistDartLength) * dartRatio + ) + // points.shoulderDartTipCpDownOutside = points.shoulderDartTipCpDownOutside.rotate( options.dartOutsideCP *10, points.shoulderDartOutside ) + + points.shoulderDartTipCpDownInside = points.shoulderDartInside.shiftFractionTowards( + points.shoulderDartTip, + 1 + (1 - options.upperDartLength) + (1 - options.waistDartLength) * dartRatio + ) + points.armholeDartTipCpDownInside = points.armholeDartTip.shiftFractionTowards( + // points.waistDartHem, + points.waistDartLeft, + 1 - options.upperDartLength + (1 - options.waistDartLength) * dartRatio + ) + + points.bustAcp = points.waistDartRight.shiftOutwards(points.bustA, 10) + + paths.shoulderInsideSeam = new Path() + .move(points.waistDartLeft) + .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) + .line(points.shoulderDartInside) + .hide() + + paths.armholeInsideSeam = new Path() + .move(points.waistDartLeft) + .curve(points.waistDartLeftCp, points.armholeDartTipCpDownInside, points.armholeDartTip) + .hide() + + paths.sOutsideSeam = new Path() + .move(points.waistDartRight) + .curve(points.bustAcp, points.shoulderDartTipCpDownOutside, points.shoulderDartOutside) + .hide() + + points.waistDartRightCp = points.bustAcp.clone() + + const shoulderInsideSeam = new Path() + .move(points.waistDartLeft) + .curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip) + .line(points.shoulderDartInside) + .hide() + + points.waistUpDartLeft = paths.armholeInsideSeam.shiftAlong( + points.waistDartLeft.dist(points.armholeDartTip) * 0.5 + ) + points.waistCircleInsideCp1 = points.waistUpDartLeft.shiftTowards( + points.waistDartLeft, + -0.5 * bCircle * points.armholeDartOutside.dist(points.armholeDartTip) + ) + points.shoulderDartTipCpDownOutside = points.shoulderDartTipCpDownOutside + .rotate(-2.5, points.shoulderDartOutside) + .shiftFractionTowards(points.shoulderDartOutside, 0.2) + + let iteration = 1 + let diff = 0 + do { + points.waistDartRight = points.waistDartRight.rotate(diff * 0.1, points.sideHemInitial) + + let outsideSeam = new Path() + .move(points.waistDartRight) + .curve(points.bustAcp, points.shoulderDartTipCpDownOutside, points.shoulderDartOutside) + + points.waistUpDartRight = outsideSeam.shiftAlong( + points.waistDartRight.dist(points.waistDartRightCp) * 0.5 + ) + points.waistUpDartRightCpDown = points.waistUpDartRight.shiftFractionTowards( + points.waistDartRight, + 0.25 + ) + // points.waistUpDartRightCpUp = points.waistUpDartRight.shiftFractionTowards( points.waistDartRight, -.25 ) + points.waistUpDartRightCpUp = points.waistUpDartRight.shiftFractionTowards( + points.waistDartRight, + -0.6 + ) + points.waistCpUp = points.waistDartRight + .shiftTowards( + points.sideHemInitial, + points.waistDartRight.dist(points.waistUpDartRight) * 0.25 + ) + .rotate(90, points.waistDartRight) + points.waistCircleInsideCp1 = points.armholeDartTip.shiftTowards( + points.armholeDartTipCpDownInside, + -0.5 * bCircle * points.armholeDartInside.dist(points.armholeDartTip) + ) + + outsideSeam = new Path() + .move(points.waistDartRight) + .curve(points.waistCpUp, points.waistUpDartRightCpDown, points.waistUpDartRight) + .curve( + points.waistUpDartRightCpUp, + points.shoulderDartTipCpDownOutside, + points.shoulderDartOutside + ) + + diff = shoulderInsideSeam.length() - outsideSeam.length() + iteration++ + } while ((diff > 1 || diff < -1) && iteration < 200) + if (iteration >= 200) { + log.error('Something is not quite right here!') + } + points.waistDartRightCp = points.bustAcp.clone() + points.armholeDartTipInside = points.armholeDartTip.clone() + points.waistCircleOutsideCp1 = points.waistUpDartRight.shiftTowards( + points.waistDartRight, + -1 * bCircle * points.armholeDartOutside.dist(points.armholeDartTip) + ) + + diff = 0 + iteration = 0 + do { + const dist = points.armholeDartTipInside.dist(points.armholeDartTipCpDownInside) + if (points.armholeDartTipInside.x > points.waistCircleOutsideCp1) { + points.armholeDartTipInside.x = points.armholeDartTipInside.x - 0.5 + points.armholeDartTipInside.y = points.armholeDartTipInside.y + 0.5 + } else { + points.waistCircleOutsideCp1 = points.waistCircleOutsideCp1.shiftTowards( + points.waistUpDartRight, + diff > 0 ? 1 : -1 + ) + } + points.armholeDartTipCpDownInside = points.waistCircleInsideCp1.shiftOutwards( + points.armholeDartTipInside, + dist + ) + + paths.armholeTempCircleOutside = new Path() + .move(points.armholeDartOutside) + .curve( + points.armholeCircleOutsideCp1, + points.waistCircleOutsideCp1, + points.waistUpDartRight + ) + .curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight) + .hide() + .attr('class', 'lining') + paths.armholeTempCircleInside = new Path() + .move(points.armholeDartInside) + .curve( + points.armholeCircleInsideCp1, + points.waistCircleInsideCp1, + points.armholeDartTipInside + ) + .curve(points.armholeDartTipCpDownInside, points.waistDartLeftCp, points.waistDartLeft) + .hide() + .attr('class', 'lining') + + diff = paths.armholeTempCircleOutside.length() - paths.armholeTempCircleInside.length() + iteration++ + } while ((diff < -1 || diff > 1) && iteration < 200) + if (iteration >= 200) { + log.error('Something is not quite right here!') + } + + return part + }, } diff --git a/designs/noble/src/options.mjs b/designs/noble/src/options.mjs index 553b2586953..8e6357e87cb 100644 --- a/designs/noble/src/options.mjs +++ b/designs/noble/src/options.mjs @@ -1,9 +1,11 @@ +import { pctBasedOn } from '@freesewing/core' + // Constants export const shoulderToShoulderCorrection = 0.995 export const bustDartCurve = 1 export const bustDartLength = 0.9 // Percentages -export const bustSpanEase = { pct: 0, min: -5, max: 20, menu: 'fit' } +export const bustSpanEase = { pct: 0, min: -5, max: 20, ...pctBasedOn('bustSpan'), menu: 'fit' } export const backHemSlope = { deg: 2.5, min: 0, max: 5, menu: 'advanced' } export const upperDartLength = { pct: 90, min: 80, max: 95, menu: 'darts' } export const dartPosition = { dflt: 'shoulder', list: ['shoulder', 'armhole'], menu: 'darts' } @@ -11,13 +13,11 @@ export const shoulderDartPosition = { pct: 50, min: 10, max: 90, - // eslint-disable-next-line no-unused-vars - menu: (settings, mergedOptions) => (mergedOptions?.dartPosition != 'shoulder' ? 'darts' : false), + menu: (settings, mergedOptions) => (mergedOptions.dartPosition === 'shoulder' ? 'darts' : false), } export const armholeDartPosition = { pct: 50, min: 10, max: 90, - // eslint-disable-next-line no-unused-vars - menu: (settings, mergedOptions) => (mergedOptions?.dartPosition == 'shoulder' ? 'darts' : false), + menu: (settings, mergedOptions) => (mergedOptions.dartPosition === 'armhole' ? 'darts' : false), } diff --git a/designs/octoplushy/i18n/en.json b/designs/octoplushy/i18n/en.json index 37c13efb474..6de519c5107 100644 --- a/designs/octoplushy/i18n/en.json +++ b/designs/octoplushy/i18n/en.json @@ -10,16 +10,45 @@ "headSection1": "Head section 1", "headSection2": "Head section 2" }, - "s": {}, + "s": { + "eye": "Eye", + "mouth": "Mouth", + "stichLine": "Stitch line", + "foldLine": "Fold lines", + "octopusEye.t": "The octopus eye is not shown", + "octopusEye.d": "The **Octopus eye** is a circular piece of fabric with a diameter of {{{ width }}} (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.", + "octopusPupil.t": "The octopus pupil is not shown", + "octopusPupil.d": "The **Octopus pupil** is a circular piece of fabric with a diameter of {{{ width }}} (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.", + "octopusEyebrow.t": "The octopus eyebrow is not shown", + "octopusEyebrow.d": "The **Octopus eyebrow** is a rectangular piece of fabric {{{ width }}} wide and {{{ length }}} long (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.", + "squidEye.t": "The squid eye is not shown", + "squidEye.d": "The **Squid eye** is a circular piece of fabric with a diameter of {{{ width }}} (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.", + "squidPupil.t": "The squid pupil is not shown", + "squidPupil.d": "The **Squid pupil** is a circular piece of fabric with a diameter of {{{ width }}} (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.", + "squidEyebrow.t": "The squid eyebrow is not shown", + "squidEyebrow.d": "The **Squid eyebrow** is a rectangular piece of fabric {{{ width }}} wide and {{{ length }}} long (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part." + }, "o": { "size": { "t": "Size", - "d": "Controls the overall size" + "d": "Controls the overall size (value shown is the size of the head)" }, "type": { "t": "Type", "d": "Allows you to choose one of the variants of this design" }, + "type.octoplushy": { + "t": "Octoplushy", + "d": "Draft the octoplushy variant" + }, + "type.octopus": { + "t": "Octopus", + "d": "Draft the octopus variant" + }, + "type.squid": { + "t": "Squid", + "d": "Draft the squid variant" + }, "armWidth": { "t": "Arm width", "d": "Controls the width of the arms" @@ -38,15 +67,15 @@ }, "bottomTopArmRatio": { "t": "Bottom/Top arm ratio", - "d": "FIXME: No idea what this does" + "d": "Changes the ratio between the fabric on the top of the arms versus that on the bottom of the arms" }, "bottomArmReduction": { "t": "Bottom arm reduction", - "d": "FIXME: No idea what this does" + "d": "This changes how long the bottom fabric of the arms is compared to the top fabric. It makes the arms more curly" }, "bottomArmReductionPlushy": { "t": "Bottom arm reduction (plushy)", - "d": "FIXME: No idea what this does" + "d": "This changes how long the bottom fabric of the arms is compared to the top fabric. It makes the arms more curly" } } } diff --git a/designs/octoplushy/package.json b/designs/octoplushy/package.json index ae97dfeee4a..5633b0f579a 100644 --- a/designs/octoplushy/package.json +++ b/designs/octoplushy/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/octoplushy/src/arm.mjs b/designs/octoplushy/src/arm.mjs index 379bd0f073e..dc77e45ec74 100644 --- a/designs/octoplushy/src/arm.mjs +++ b/designs/octoplushy/src/arm.mjs @@ -10,12 +10,11 @@ function octoplushyArmSection( paths, Snippet, snippets, - complete, sa, - paperless, macro, utils, store, + complete, part, } ) { @@ -27,9 +26,9 @@ function octoplushyArmSection( const w = options.sizeConstant * options.size const sections = options.type == 'squid' ? 10 : 8 - let sectionWidth = (w * 2) / sections - let armWidth = (w * options.armWidth * options.bottomTopArmRatio * 3.1415) / 2 - let armAdjustedWidth = armWidth * options.bottomTopArmRatio + const sectionWidth = (w * 2) / sections + const armWidth = w * options.armWidth * (1 - options.bottomTopArmRatio) * 3.1415 + const armAdjustedWidth = armWidth * (1 - options.bottomTopArmRatio) let armLength = ((w * 2) / 3.1415) * options.armLength switch (options.type) { case 'octopus': @@ -67,7 +66,8 @@ function octoplushyArmSection( points.armMiddleCp1 = points.armMiddle.shiftFractionTowards(points.skirtLeft2, c) points.skirtLeft3 = new Point((-1 * armAdjustedWidth) / 2, points.skirtLeft2.y) points.skirtLeft = points.skirtLeft3.clone() - let pHelper = points.skirtLeft.shift(store.get('armSkirtToTopAngle'), 10) + + const pHelper = points.skirtLeft.shift(store.get('armSkirtToTopAngle'), 10) if (Math.round(pHelper.x * 1000) <= Math.round((armAdjustedWidth / -2) * 1000)) { points.armTopLeft = points.skirtLeft.clone() } else { @@ -98,7 +98,7 @@ function octoplushyArmSection( ) if (options.type == 'octopus') { - let pSkirtLeft = new Path() + const pSkirtLeft = new Path() .move(points.armTopLeft) .curve(points.armTopLeftCp2, points.armMiddleCp1, points.armMiddle) @@ -195,119 +195,132 @@ function octoplushyArmSection( .join(paths.topRight) .close() - // Complete? + points.logo = points.armMiddle.shiftFractionTowards(points.armBottom, 0.08) + snippets.logo = new Snippet('logo', points.logo).attr('data-scale', 0.4) + points.gridAnchor = points.logo.clone() + if (complete) { - points.logo = points.armMiddle.shiftFractionTowards(points.armBottom, 0.08) - snippets.logo = new Snippet('logo', points.logo).attr('data-scale', 0.4) + points.armMiddle.addText('C', 'center') + points.armTopLeft.addText('D', 'center') + points.armTopRight.addText('D', 'center') + } - points.armMiddle.attr('data-text', 'C').attr('data-text-class', 'center') - points.armTopLeft.attr('data-text', 'D').attr('data-text-class', 'center') - points.armTopRight.attr('data-text', 'D').attr('data-text-class', 'center') + points.titleAnchor = points.armMiddle + .shiftFractionTowards(points.armBottom, 0.2) + .shift(180, sectionWidth * 0.1) - points.titleAnchor = points.armMiddle - .shiftFractionTowards(points.armBottom, 0.2) - .shift(180, sectionWidth * 0.1) + macro('title', { + at: points.titleAnchor, + nr: 2 + partNumber * 3, + title: 'arm' + (partNumber == 0 ? '' : ' (a)'), + rotation: 90, + scale: 0.3, + }) - macro('title', { - at: points.titleAnchor, - nr: 2 + partNumber * 3, - title: 'Arm' + (partNumber == 0 ? '' : ' (a)'), - rotation: 90, - scale: 0.3, - }) + if (partNumber == 1) { + store.cutlist.addCut({ cut: 2, from: 'undersideFabric', identical: true }) + } else { + store.cutlist.addCut({ cut: 8, from: 'undersideFabric', identical: true }) + } - for (var i = 0; i < 4; i++) { - snippets[`armLeft${i}`] = new Snippet( - 'notch', - points.armTopLeft.shiftFractionTowards(points.armBottomLeft, i / 4) - ) - snippets[`armRight${i}`] = new Snippet( - 'notch', - points.armTopRight.shiftFractionTowards(points.armBottomRight, i / 4) - ) - } - if (options.type == 'octopus') { - points.skirtArmLeft = utils.curveIntersectsX( - points.skirtLeft, - points.skirtLeft, - points.armMiddleCp1, - points.armMiddle, - points.armTopLeft.x - ) - points.skirtArmRight = points.skirtArmLeft.flipX(points.sectionTop) + for (var i = 0; i < 4; i++) { + snippets[`armLeft${i}`] = new Snippet( + 'notch', + points.armTopLeft.shiftFractionTowards(points.armBottomLeft, i / 4) + ) + snippets[`armRight${i}`] = new Snippet( + 'notch', + points.armTopRight.shiftFractionTowards(points.armBottomRight, i / 4) + ) + } + if (options.type == 'octopus') { + points.skirtArmLeft = utils.curveIntersectsX( + points.skirtLeft, + points.skirtLeft, + points.armMiddleCp1, + points.armMiddle, + points.armTopLeft.x + ) + points.skirtArmRight = points.skirtArmLeft.flipX(points.sectionTop) + if (complete) { paths.armLeftLine = new Path() .move(points.skirtArmLeft) .line(points.armTopLeft) - .attr('data-text', 'stitch line') - .attr('data-text-class', 'center') - .attr('class', 'hint dotted') + .addClass('hint dotted') + .addText('stitchLine', 'center') paths.armRightLine = new Path() .move(points.armTopRight) .line(points.skirtArmRight) - .attr('data-text', 'stitch line') - .attr('data-text-class', 'center') - .attr('class', 'hint dotted') + .addClass('hint dotted') + .addText('stitchLine', 'center') } + } - if (sa) { - paths.sa = paths.section.offset(sa).attr('class', 'fabric sa') - } + if (sa) { + paths.sa = paths.section.offset(sa).attr('class', 'fabric sa') + } - if (paperless) { + macro('hd', { + from: points.armTopLeft, + to: points.armTopRight, + y: points.armMiddle.y - sa, + id: 'topWidth', + }) + macro('hd', { + from: points.armBottomLeft, + to: points.armBottomRight, + y: points.armBottom.y + sa + 10, + id: 'bottomWidth', + }) + + macro('vd', { + from: points.armBottom, + to: points.armMiddle, + x: points.skirtLeft.x - sa - 20, + id: 'height', + }) + + if (options.type == 'octopus') { + macro('hd', { + from: points.skirtLeft, + to: points.skirtRight, + y: points.skirtRight.y, + id: 'skirtWidth', + }) + macro('vd', { + from: points.skirtLeft, + to: points.armMiddle, + x: points.skirtLeft.x - sa - 10, + id: 'skirtHeight', + }) + macro('vd', { + from: points.armTopLeft, + to: points.skirtLeft, + x: points.skirtLeft.x - sa - 10, + id: 'skirtToArm', + }) + } else { + macro('vd', { + from: points.armTopLeft, + to: points.armMiddle, + x: points.skirtLeft.x - sa - 10, + id: 'topToArm', + }) + } + if (options.type == 'squid') { + if (partNumber == 1) { macro('hd', { - from: points.armTopLeft, - to: points.armTopRight, - y: points.armMiddle.y - sa, + from: points.tentacleLeft, + to: points.tentacleRight, + y: points.tentacleRight.y, + id: 'tentacleWidth', }) - macro('hd', { - from: points.armBottomLeft, - to: points.armBottomRight, - y: points.armBottom.y + sa + 10, - }) - macro('vd', { from: points.armBottom, - to: points.armMiddle, - x: points.skirtLeft.x - sa - 20, + to: points.tentacleLeft, + x: points.tentacleLeft.x - sa - 10, + id: 'tentacleHeight', }) - - if (options.type == 'octopus') { - macro('hd', { - from: points.skirtLeft, - to: points.skirtRight, - y: points.skirtRight.y, - }) - macro('vd', { - from: points.skirtLeft, - to: points.armMiddle, - x: points.skirtLeft.x - sa - 10, - }) - macro('vd', { - from: points.armTopLeft, - to: points.skirtLeft, - x: points.skirtLeft.x - sa - 10, - }) - } else { - macro('vd', { - from: points.armTopLeft, - to: points.armMiddle, - 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.armBottom, - to: points.tentacleLeft, - x: points.tentacleLeft.x - sa - 10, - }) - } - } } } diff --git a/designs/octoplushy/src/eye.mjs b/designs/octoplushy/src/eye.mjs index 0b1b2c9f731..c3ed16d087d 100644 --- a/designs/octoplushy/src/eye.mjs +++ b/designs/octoplushy/src/eye.mjs @@ -2,23 +2,9 @@ import { headSection1 } from './head.mjs' function octoplushyEye( partNumber, - { - options, - Point, - Path, - points, - paths, - Snippet, - snippets, - complete, - sa, - paperless, - macro, - store, - part, - } + { options, Point, Path, points, paths, Snippet, snippets, sa, macro, expand, units, store, part } ) { - if (options.type != 'squid' && options.type != 'octopus') { + if (options.type == 'octoplushy') { return part } if (partNumber > (options.type == 'squid' ? 1 : 2)) { @@ -27,14 +13,39 @@ function octoplushyEye( const c = 0.55191502449351 - let sectionWidth = store.get('sectionWidth') - let eyeSize = sectionWidth / 1.5 - let logoScale = 0.25 - let titleScale = 0.25 - if (partNumber == 1) { - eyeSize *= 0.65 - logoScale = 0.15 - titleScale = 0.16 + const sectionWidth = store.get('sectionWidth') + const logoScale = 0.35 + const titleScale = 0.25 + const eyeSize = (sectionWidth / 1.5) * (partNumber === 1 ? 0.65 : 1) + const eyeBrowWidth = eyeSize * 0.375 + const eyeCirc = (eyeSize + eyeBrowWidth * 2) * Math.PI + + if (expand) { + // Hint about expand + store.flag.preset('expandIsOn') + } else { + // Expand is off, do not draw the part but flag this to the user + const message = + (options.type == 'squid' ? `squid` : 'octopus') + + (partNumber == 2 ? 'Eyebrow' : partNumber == 1 ? 'Pupil' : 'Eye') + store.flag.note({ + msg: message, + replace: { + width: units(eyeCirc + 2 * sa), + length: units(eyeBrowWidth * 2 + 2 * sa), + }, + suggest: { + text: 'flag:show', + icon: 'expand', + update: { + settings: ['expand', 1], + }, + }, + }) + // Also hint about expand + store.flag.preset('expandIsOff') + + return part.hide() } if (partNumber < 2) { @@ -60,16 +71,12 @@ function octoplushyEye( .curve(points.rightCp1, points.topCp2, points.top) .close() .attr('class', 'fabric') - .hide() + points.logo = points.top.shiftFractionTowards(points.bottom, 0.3) points.titleAnchor = points.bottom .shiftFractionTowards(points.top, 0.25) .shift(180, eyeSize / 10) } else { - logoScale = 0.35 - titleScale = 0.25 - let eyeBrowWidth = eyeSize * 0.375 - 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) @@ -83,7 +90,6 @@ function octoplushyEye( .line(points.tl) .close() .attr('class', 'fabric') - .hide() points.logo = points.tl .shiftFractionTowards(points.bl, 0.5) @@ -92,41 +98,46 @@ function octoplushyEye( .shiftFractionTowards(points.br, 0.5) .shiftFractionTowards(points.bl, 0.3) } - if (complete) { - snippets.logo = new Snippet('logo', points.logo).attr('data-scale', logoScale) + points.gridAnchor = points.logo.clone() - macro('title', { - at: points.titleAnchor, - nr: 3 + partNumber * 3, - title: partNumber == 2 ? 'eyebrow' : partNumber == 1 ? 'pupil' : 'eye', - scale: titleScale, - }) + snippets.logo = new Snippet('logo', points.logo).attr('data-scale', logoScale) - if (sa) { - paths.sa = paths.eye.offset(Math.min(sa, 6)).attr('class', 'fabric sa') - } + macro('title', { + at: points.titleAnchor, + nr: 3 + partNumber * 3, + title: partNumber == 2 ? 'eyebrow' : partNumber == 1 ? 'pupil' : 'eye', + scale: titleScale, + }) + + store.cutlist.addCut({ + cut: 2, + from: partNumber == 2 ? 'fabric' : partNumber == 1 ? 'pupilFabric' : 'eyeFabric', + }) + + if (sa) { + paths.sa = paths.eye.offset(Math.min(sa, 6)).attr('class', 'fabric sa') } - // Paperless? - 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, - }) - } + if (partNumber < 2) { + macro('hd', { + from: points.left, + to: points.right, + y: points.top.y - sa, + id: 'width', + }) + } else { + macro('hd', { + from: points.tl, + to: points.tr, + y: points.tl.y - sa, + id: 'width', + }) + macro('vd', { + from: points.bl, + to: points.tl, + x: points.tl.x - sa, + id: 'height', + }) } return part diff --git a/designs/octoplushy/src/head.mjs b/designs/octoplushy/src/head.mjs index c07eb626f54..fabb8b0141a 100644 --- a/designs/octoplushy/src/head.mjs +++ b/designs/octoplushy/src/head.mjs @@ -8,12 +8,11 @@ function octoplushyHeadSection( paths, Snippet, snippets, - complete, sa, - paperless, macro, utils, store, + complete, part, } ) { @@ -26,10 +25,10 @@ function octoplushyHeadSection( const h = options.sizeConstant * options.size * 0.5 const sections = options.type == 'squid' ? 10 : 8 - let sectionWidth = (w * 2) / sections - let neckWidth = sectionWidth * options.neckWidth - let armWidth = (w * options.armWidth * options.bottomTopArmRatio * 3.1415) / 2 - let armAdjustedWidth = armWidth * options.bottomTopArmRatio + const sectionWidth = (w * 2) / sections + const neckWidth = sectionWidth * options.neckWidth + const armWidth = w * options.armWidth * options.bottomTopArmRatio * 3.1415 + const armAdjustedWidth = armWidth * options.bottomTopArmRatio let armLength = ((w * 2) / 3.1415) * options.armLength if (options.type == 'octopus') { armLength *= 2 @@ -41,13 +40,6 @@ function octoplushyHeadSection( } } - // console.log({ w: w }) - // console.log({ sectionWidth: sectionWidth }) - // console.log({ neckWidth: neckWidth }) - // console.log({ armAdjustedWidth: w * options.armWidth * options.bottomTopArmRatio }) - // console.log({ toparmWidth: armAdjustedWidth }) - // console.log({ armLength: armLength }) - points.topLeft = new Point(-1 * w, -1 * h) points.topRight = new Point(w, -1 * h) points.bottomLeft = new Point(-1 * w, h) @@ -58,11 +50,10 @@ function octoplushyHeadSection( points.sectionTop = new Point(0, -1 * h) points.sectionBottom = new Point(0, h) points.sectionLeft = new Point((-1 * sectionWidth) / 2, 0) - let sectionMid = points.sectionLeft.shiftFractionTowards(points.sectionTop, 0.5) + const sectionMid = points.sectionLeft.shiftFractionTowards(points.sectionTop, 0.5) const sectionAngle = sectionMid.angle(points.sectionTop) - - let lineEnd = sectionMid.shift(sectionAngle - 90, 1000) + const lineEnd = sectionMid.shift(sectionAngle - 90, 1000) points.circleCenter = utils.beamIntersectsY(sectionMid, lineEnd, 0) const circleRadius = points.circleCenter.dist(points.sectionTop) @@ -95,7 +86,7 @@ function octoplushyHeadSection( points.lowerLeft.y ) - let currentNeckWidth = (points.sectionTop.x - points.sectionBottomLeft.x) * 2 + const currentNeckWidth = (points.sectionTop.x - points.sectionBottomLeft.x) * 2 diff = neckWidth - currentNeckWidth div = div * (currentNeckWidth / neckWidth) @@ -116,7 +107,7 @@ function octoplushyHeadSection( points.lowerLeft.y ) - let sectionLeft = paths.circle.split(points.sectionTop)[1].split(points.sectionBottomLeft)[0] + const sectionLeft = paths.circle.split(points.sectionTop)[1].split(points.sectionBottomLeft)[0] points.sectionTop = sectionLeft.ops[0].to.clone() points.sectionTopCp1 = sectionLeft.ops[1].cp1.clone() @@ -178,8 +169,8 @@ function octoplushyHeadSection( ) if (options.type == 'octopus') { - let octopusHeadFactor = 0.7 - let sectionHeight = points.sectionBottom.dist(points.sectionTop) + const octopusHeadFactor = 0.7 + const sectionHeight = points.sectionBottom.dist(points.sectionTop) points.sectionTop = points.sectionTop.shift(90, sectionHeight * octopusHeadFactor) points.sectionTopCp1 = points.sectionTopCp1.shift(90, sectionHeight * octopusHeadFactor) points.sectionLeft = points.sectionLeft.shift(90, (sectionHeight * octopusHeadFactor) / 1.1) @@ -192,7 +183,7 @@ function octoplushyHeadSection( (sectionHeight * octopusHeadFactor) / 1.1 ) - let pSkirtLeft = new Path() + const pSkirtLeft = new Path() .move(points.skirtBottomLeft) .curve(points.skirtBottomLeft, points.sectionBottomLeftCp1, points.sectionBottomLeft) @@ -233,19 +224,19 @@ function octoplushyHeadSection( points.armBottom = points.armBottom.flipY(points.tentacleLeft) points.armBottomCp2 = points.armBottomCp2.flipY(points.tentacleLeft) - let pLeftSection = new Path() + const pLeftSection = new Path() .move(points.sectionLeft) .curve(points.sectionLeftCp2, points.sectionTopCp1, points.sectionTop) points.finSection = pLeftSection.shiftFractionAlong(0.45) - let pLeftCurves = pLeftSection.split(points.finSection) + const pLeftCurves = pLeftSection.split(points.finSection) points.sectionLeftCp2 = pLeftCurves[0].ops[1].cp1.clone() points.finSectionCp1 = pLeftCurves[0].ops[1].cp2.clone() points.finFold = points.finSection.rotate(-20, points.sectionTop) points.finSeam = points.finSection.rotate(-40, points.sectionTop) - let foldAngle = points.sectionTop.angle(points.finFold) - let aCp1 = points.sectionTop.angle(pLeftCurves[1].ops[1].cp1) - foldAngle - let aCp2 = points.sectionTop.angle(pLeftCurves[1].ops[1].cp2) - foldAngle + const foldAngle = points.sectionTop.angle(points.finFold) + const aCp1 = points.sectionTop.angle(pLeftCurves[1].ops[1].cp1) - foldAngle + const aCp2 = points.sectionTop.angle(pLeftCurves[1].ops[1].cp2) - foldAngle points.finSeamCp2 = points.sectionTop.shift( foldAngle - aCp1, points.sectionTop.dist(pLeftCurves[1].ops[1].cp1) @@ -385,212 +376,230 @@ function octoplushyHeadSection( .close() .attr('class', 'fabric') - // Complete? - if (complete) { - points.logo = points.sectionTop.shiftFractionTowards( - points.sectionBottom, - options.type == 'octoplushy' ? 0.3 : 0.5 + points.logo = points.sectionTop.shiftFractionTowards( + points.sectionBottom, + options.type == 'octoplushy' ? 0.3 : 0.5 + ) + snippets.logo = new Snippet('logo', points.logo).attr('data-scale', 0.4) + points.gridAnchor = points.skirtTopMiddle.clone() + + if (partNumber == 1) { + store.cutlist.addCut({ cut: 2, from: 'fabric', identical: true }) + } else { + store.cutlist.addCut({ cut: 8, from: 'fabric', identical: true }) + } + + points.titleAnchor = points.sectionBottom + .shiftFractionTowards(points.sectionTop, options.type == 'octoplushy' ? 0.3 : 0.4) + .shift(180, sectionWidth * 0.2) + macro('title', { + at: points.titleAnchor, + nr: 1 + partNumber * 3, + title: 'head' + (partNumber == 0 ? '' : ' (a)'), + rotation: 90, + scale: options.type == 'octoplushy' ? 0.35 : 0.5, + }) + + if (options.type == 'octoplushy') { + points.eyeLeft = paths.sectionLeft.shiftFractionAlong(0.465) + points.eyeRight = points.eyeLeft.flipX(points.sectionTop) + if (complete) { + points.eyeLeft.addText('eye', 'center') + points.eyeRight.addText('eye', 'center') + } + snippets.eyeLeft = new Snippet('button', points.eyeLeft) + snippets.eyeRight = new Snippet('button', points.eyeRight) + + points.mouthMiddle = points.sectionBottom.shiftFractionTowards(points.sectionTop, 0.45) + points.mouthLeft = points.mouthMiddle.shift(180, sectionWidth / 4) + points.mouthRight = points.mouthMiddle.shift(0, sectionWidth / 4) + points.mouthBottom = points.mouthMiddle.shift(270, sectionWidth / 4) + points.mouthLeftCp1 = points.mouthLeft.shift(270, (sectionWidth / 4) * c) + points.mouthRightCp2 = points.mouthRight.shift(270, (sectionWidth / 4) * c) + points.mouthBottomCp2 = points.mouthBottom.shift(180, (sectionWidth / 4) * c) + points.mouthBottomCp1 = points.mouthBottom.shift(0, (sectionWidth / 4) * c) + paths.mouth = new Path() + .move(points.mouthLeft) + .curve(points.mouthLeftCp1, points.mouthBottomCp2, points.mouthBottom) + .curve(points.mouthBottomCp1, points.mouthRightCp2, points.mouthRight) + .attr('class', 'stroke-lg') + if (complete) paths.mouth.addText('mouth', 'text-xs center') + } + + if (options.type == 'squid' && partNumber == 1 && complete) { + paths.fold = new Path() + .move(points.sectionTop) + .line(points.finFold) + .addClass('hint dotted') + .addText('foldLine', 'center') + } + if (options.type == 'octopus') { + points.skirtArmLeft = utils.curveIntersectsX( + points.sectionBottomLeft, + points.sectionBottomLeftCp1, + points.skirtBottomLeft, + points.skirtBottomLeft, + points.armTopLeft.x ) - snippets.logo = new Snippet('logo', points.logo).attr('data-scale', 0.4) - - points.titleAnchor = points.sectionBottom - .shiftFractionTowards(points.sectionTop, options.type == 'octoplushy' ? 0.3 : 0.4) - .shift(180, sectionWidth * 0.2) - macro('title', { - at: points.titleAnchor, - nr: 1 + partNumber * 3, - title: 'Head' + (partNumber == 0 ? '' : ' (a)'), - rotation: 90, - scale: options.type == 'octoplushy' ? 0.35 : 0.5, - }) - - if (options.type == 'octoplushy') { - points.eyeLeft = paths.sectionLeft - .shiftFractionAlong(0.465) - .attr('data-text', 'eye') - .attr('data-text-class', 'center') - points.eyeRight = points.eyeLeft - .flipX(points.sectionTop) - .attr('data-text', 'eye') - .attr('data-text-class', 'center') - snippets.eyeLeft = new Snippet('button', points.eyeLeft) - snippets.eyeRight = new Snippet('button', points.eyeRight) - - points.mouthMiddle = points.sectionBottom.shiftFractionTowards(points.sectionTop, 0.45) - points.mouthLeft = points.mouthMiddle.shift(180, sectionWidth / 4) - points.mouthRight = points.mouthMiddle.shift(0, sectionWidth / 4) - points.mouthBottom = points.mouthMiddle.shift(270, sectionWidth / 4) - points.mouthLeftCp1 = points.mouthLeft.shift(270, (sectionWidth / 4) * c) - points.mouthRightCp2 = points.mouthRight.shift(270, (sectionWidth / 4) * c) - points.mouthBottomCp2 = points.mouthBottom.shift(180, (sectionWidth / 4) * c) - points.mouthBottomCp1 = points.mouthBottom.shift(0, (sectionWidth / 4) * c) - paths.mouth = new Path() - .move(points.mouthLeft) - .curve(points.mouthLeftCp1, points.mouthBottomCp2, points.mouthBottom) - .curve(points.mouthBottomCp1, points.mouthRightCp2, points.mouthRight) - .attr('data-text', 'mouth') - .attr('data-text-class', 'text-xs center') - .attr('class', 'stroke-lg') - } - - if (options.type == 'squid' && partNumber == 1) { - paths.fold = new Path() - .move(points.sectionTop) - .line(points.finFold) - .attr('data-text', 'fold line') - .attr('data-text-class', 'center') - .attr('class', 'hint dotted') - } - if (options.type == 'octopus') { - points.skirtArmLeft = utils.curveIntersectsX( - points.sectionBottomLeft, - points.sectionBottomLeftCp1, - points.skirtBottomLeft, - points.skirtBottomLeft, - points.armTopLeft.x - ) - points.skirtArmRight = points.skirtArmLeft.flipX(points.sectionTop) + points.skirtArmRight = points.skirtArmLeft.flipX(points.sectionTop) + if (complete) { paths.armLeftLine = new Path() .move(points.skirtArmLeft) .line(points.armTopLeft) - .attr('data-text', 'stitch line') - .attr('data-text-class', 'center') - .attr('class', 'hint dotted') + .addClass('class', 'hint dotted') + .addText('stitchLine', 'center') paths.armRightLine = new Path() .move(points.armTopRight) .line(points.skirtArmRight) - .attr('data-text', 'stitch line') - .attr('data-text-class', 'center') - .attr('class', 'hint dotted') - } - points.sectionTop.attr('data-text', 'A').attr('data-text-class', 'center') - points.armTopLeft.attr('data-text', 'B').attr('data-text-class', 'center') - points.armTopRight.attr('data-text', 'B').attr('data-text-class', 'center') - - snippets.left = new Snippet('notch', points.sectionLeft) - snippets.right = new Snippet('notch', points.sectionRight) - snippets.bottomLeft = new Snippet('notch', points.sectionBottomLeft) - snippets.bottomRight = new Snippet('notch', points.sectionBottomRight) - for (var i = 0; i < 4; i++) { - snippets[`armLeft${i}`] = new Snippet( - 'notch', - points.armTopLeft.shiftFractionTowards(points.armBottomLeft, i / 4) - ) - snippets[`armRight${i}`] = new Snippet( - 'notch', - points.armTopRight.shiftFractionTowards(points.armBottomRight, i / 4) - ) - } - - if (sa) { - paths.sa = paths.section.offset(sa).attr('class', 'fabric sa') + .addClass('class', 'hint dotted') + .addText('stitchLine', 'center') } } + if (complete) { + points.sectionTop.addText('A', 'center') + points.armTopLeft.addText('B', 'center') + points.armTopRight.addText('B', 'center') + } - // Paperless? - if (paperless) { - macro('hd', { - from: points.sectionLeft, - to: points.sectionRight, - y: points.sectionTop.y - sa, - }) - macro('hd', { - from: points.armTopLeft, - to: points.armTopRight, - y: points.armTopRight.y, - }) - macro('hd', { - from: points.armBottomLeft, - to: points.armBottomRight, - y: points.armBottom.y + sa + 10, - }) + snippets.left = new Snippet('notch', points.sectionLeft) + snippets.right = new Snippet('notch', points.sectionRight) + snippets.bottomLeft = new Snippet('notch', points.sectionBottomLeft) + snippets.bottomRight = new Snippet('notch', points.sectionBottomRight) + for (var i = 0; i < 4; i++) { + snippets[`armLeft${i}`] = new Snippet( + 'notch', + points.armTopLeft.shiftFractionTowards(points.armBottomLeft, i / 4) + ) + snippets[`armRight${i}`] = new Snippet( + 'notch', + points.armTopRight.shiftFractionTowards(points.armBottomRight, i / 4) + ) + } - macro('vd', { - from: points.sectionTop, - to: points.sectionRight, - x: points.skirtBottomRight.x + sa + 10, - }) - macro('vd', { - from: points.sectionTop, - to: points.sectionBottomRight, - x: points.skirtBottomRight.x + sa + 20, - }) - macro('vd', { - from: points.sectionTop, + if (sa) { + paths.sa = paths.section.offset(sa).attr('class', 'fabric sa') + } + + macro('hd', { + from: points.sectionLeft, + to: points.sectionRight, + y: points.sectionTop.y - sa, + id: 'headWidth', + }) + macro('hd', { + from: points.armTopLeft, + to: points.armTopRight, + y: points.armTopRight.y, + id: 'topArmWidth', + }) + macro('hd', { + from: points.armBottomLeft, + to: points.armBottomRight, + y: points.armBottom.y + sa + 10, + id: 'bottomArmWidth', + }) + + macro('vd', { + from: points.sectionTop, + to: points.sectionRight, + x: points.skirtBottomRight.x + sa + 10, + id: 'headMidHeight', + }) + macro('vd', { + from: points.sectionTop, + to: points.sectionBottomRight, + x: points.skirtBottomRight.x + sa + 20, + id: 'topToNeckHeight', + }) + macro('vd', { + from: points.sectionTop, + to: points.skirtBottomRight, + x: points.skirtBottomRight.x + sa + 30, + id: 'topToArmHeight', + }) + macro('vd', { + from: points.sectionTop, + to: points.armBottom, + x: points.skirtBottomRight.x + sa + 40, + id: 'totalHeight', + }) + + if (options.type == 'octopus') { + macro('hd', { + from: points.skirtBottomLeft, to: points.skirtBottomRight, - x: points.skirtBottomRight.x + sa + 30, + y: points.skirtBottomRight.y, + id: 'skirtWidth', }) macro('vd', { - from: points.sectionTop, - to: points.armBottom, - x: points.skirtBottomRight.x + sa + 40, + from: points.skirtBottomRight, + to: points.armTopRight, + x: points.skirtBottomRight.x + sa + 30, + id: 'skirtHeight', }) - - if (options.type == 'octopus') { + } + if (options.type == 'squid') { + macro('vd', { + from: points.armTopLeft, + to: points.sectionBottomLeft, + x: points.armTopLeft.x - sa - 10, + id: 'neckToArm', + }) + macro('vd', { + from: points.sectionBottomLeft, + to: points.sectionMidLeft, + x: points.armTopLeft.x - sa - 10, + id: 'sectionHeight', + }) + if (partNumber == 1) { macro('hd', { - from: points.skirtBottomLeft, - to: points.skirtBottomRight, - y: points.skirtBottomRight.y, + from: points.tentacleLeft, + to: points.tentacleRight, + y: points.tentacleRight.y, + id: 'tentacleWidth', + }) + macro('hd', { + from: points.finSeam, + to: points.sectionTop, + y: points.sectionTop.y, + id: 'finWidth', + }) + macro('hd', { + from: points.finSeam, + to: points.finSection, + y: points.finSection.y, + id: 'finToHead', + }) + macro('hd', { + from: points.finFold, + to: points.finSection, + y: points.finFold.y, + id: 'foldToHead', }) macro('vd', { - from: points.skirtBottomRight, - to: points.armTopRight, - x: points.skirtBottomRight.x + sa + 30, - }) - } - if (options.type == 'squid') { - macro('vd', { - from: points.armTopLeft, - to: points.sectionBottomLeft, - x: points.armTopLeft.x - sa - 10, + from: points.armBottom, + to: points.tentacleLeft, + x: points.tentacleLeft.x - sa - 10, + id: 'tentacleHeight', }) macro('vd', { - from: points.sectionBottomLeft, - to: points.sectionMidLeft, - x: points.armTopLeft.x - sa - 10, + from: points.finSeam, + to: points.sectionTop, + x: points.finSeam.x - sa, + id: 'finHeight', + }) + macro('vd', { + from: points.finFold, + to: points.sectionTop, + x: points.finSeam.x - sa - 10, + id: 'finFoldHeight', + }) + macro('vd', { + from: points.finSection, + to: points.sectionTop, + x: points.finSeam.x - sa - 20, + id: 'finToHeadHeight', }) - 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.armBottom, - 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 @@ -598,13 +607,45 @@ function octoplushyHeadSection( const options = { sizeConstant: 200, - size: { pct: 100, min: 5, max: 500, menu: 'style' }, + size: { + pct: 100, + min: 5, + max: 500, + menu: 'style', + toAbs: (val, { options }, mergedOptions) => + ((mergedOptions.sizeConstant * val * 2) / 3.1415) * + (options.type === undefined + ? 1 + : options.type == 'octopus' + ? 1.7 + : options.type == 'squid' + ? 2 + : 1), + }, 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' }, + armLength: { + pct: 200, + min: 100, + max: 500, + menu: 'style', + toAbs: (val, { options }, mergedOptions) => + ((mergedOptions.sizeConstant * + (options.size === undefined ? mergedOptions.size : options.size) * + 2) / + 3.1415) * + val * + (options.type === undefined + ? 1 + : options.type == 'octopus' + ? 2 + : options.type == 'squid' + ? 1.8 + : 1), + }, 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' }, + bottomTopArmRatio: { pct: 57, min: 25, max: 75, menu: 'style' }, bottomArmReduction: { pct: 90, min: 75, diff --git a/designs/paco/package.json b/designs/paco/package.json index ddef51a0726..6bd05013a8f 100644 --- a/designs/paco/package.json +++ b/designs/paco/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/penelope/i18n/en.json b/designs/penelope/i18n/en.json index 7ebf990ef59..91b5dda0d91 100644 --- a/designs/penelope/i18n/en.json +++ b/designs/penelope/i18n/en.json @@ -16,6 +16,14 @@ "t": "Back vent", "d": "Add a vent in the back of the skirt." }, + "backVentNo": { + "t": "No vent in the back", + "d": "This will be the challenging way to walk." + }, + "backVentYes": { + "t": "A vent in the back", + "d": "Making it easier to walk." + }, "backVentLength": { "t": "Back vent length", "d": "Length of the Back Vent as a percentage of the skirt length." @@ -24,6 +32,14 @@ "t": "Curved darts", "d": "Whether or not to used curved darts." }, + "curvedDartsNo": { + "t": "Straight darts", + "d": "The darts will be straight, for the standard look." + }, + "curvedDartsYes": { + "t": "Curved darts", + "d": "The darts will be curved, making the shape in the back and front more round." + }, "dartToSideSeamFactor": { "t": "Dart to side seam factor", "d": "Percentage of how much of the hip to waist reduction has to be taken in by the darts versus the side seam." @@ -52,13 +68,25 @@ "t": "Seat ease", "d": "Amount of ease at the seat level." }, - "waistBand": { - "t": "Waist band", + "waistband": { + "t": "Waistband", "d": "Add a waistband to the pattern." }, - "waistBandWidth": { - "t": "Waist band width", - "d": "The width of the waist band." + "waistbandNo": { + "t": "No waistband", + "d": "Just the skirt, nothing else." + }, + "waistbandYes": { + "t": "Skirt with a waistband", + "d": "Add a waistband." + }, + "waistbandOverlap": { + "t": "Waistband overlap", + "d": "How much the waistband should overlap at the front." + }, + "waistbandWidth": { + "t": "Waistband width", + "d": "The width of the waistband." }, "waistEase": { "t": "Waist ease", @@ -67,6 +95,14 @@ "zipperLocation": { "t": "Zipper location", "d": "The location of the zipper." + }, + "zipperLocation.backSeam": { + "t": "Add the zipper to the back seam", + "d": "Good option with the back vent." + }, + "zipperLocation.sideSeam": { + "t": "Add the zipper to the side seam", + "d": "Allows you to cut the back on fold, removing the seam from the back." } } } diff --git a/designs/penelope/package.json b/designs/penelope/package.json index 78683ebc04f..3ff7258e0e9 100644 --- a/designs/penelope/package.json +++ b/designs/penelope/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/penelope/src/back.mjs b/designs/penelope/src/back.mjs index f501855dad7..823f4baffa3 100644 --- a/designs/penelope/src/back.mjs +++ b/designs/penelope/src/back.mjs @@ -1,59 +1,59 @@ import { measurements, optionalMeasurements, options, BuildMainShape } from './shape.mjs' -function penelopeBack(params) { - const { - options, - measurements, - Path, - points, - paths, - Snippet, - snippets, - store, - complete, - sa, - paperless, - macro, - part, - } = params +export const back = { + name: 'penelope.back', + measurements, + optionalMeasurements, + options, + draft: (params) => { + const { + options, + measurements, + Path, + points, + paths, + Snippet, + snippets, + store, + sa, + macro, + part, + } = params - BuildMainShape(params, false) + BuildMainShape(params, false) - if (options.backVent == true) { - // I don't care what you're trying to create, the vent will not go higher than your hips. - let backVentLength = Math.min( - store.get('skirtLength') - measurements.waistToHips, - options.backVentLength * store.get('skirtLength') - ) + if (options.backVent == true) { + const backVentLength = Math.min( + store.get('skirtLength') - measurements.waistToHips, + options.backVentLength * store.get('skirtLength') + ) - points.vLeg = points.rLeg.shiftFractionTowards(points.lLeg, 1 + options.backVentWidth) - points.vHem = points.rHem.shiftFractionTowards(points.lHem, 1 + options.backVentWidth) - points.vTop = points.vLeg.shift(90, backVentLength) - points.lVent = points.vTop - .shift(0, points.lLeg.dx(points.rLeg) * options.backVentWidth) - .shift(90, points.lLeg.dx(points.rLeg) * options.backVentWidth) + points.vLeg = points.rLeg.shiftFractionTowards(points.lLeg, 1 + options.backVentWidth) + points.vHem = points.rHem.shiftFractionTowards(points.lHem, 1 + options.backVentWidth) + points.vTop = points.vLeg.shift(90, backVentLength) + points.lVent = points.vTop + .shift(0, points.lLeg.dx(points.rLeg) * options.backVentWidth) + .shift(90, points.lLeg.dx(points.rLeg) * options.backVentWidth) - paths.vent = new Path() - .move(points.lVent) - .line(points.vTop) - .line(points.vLeg) - .line(points.vHem) - .hide() + paths.vent = new Path() + .move(points.lVent) + .line(points.vTop) + .line(points.vLeg) + .line(points.vHem) + .hide() - paths.leftSide = new Path().move(points.lWaist).line(points.lVent).join(paths.vent).hide() + paths.leftSide = new Path().move(points.lWaist).line(points.lVent).join(paths.vent).hide() - paths.hem = paths.hem.line(points.vLeg) - } + paths.hem = paths.hem.line(points.vLeg) + } - paths.seam = paths.leftSide - .clone() - .join(paths.bottom) - .join(paths.sideSeam) - .join(paths.waist) - .attr('class', 'fabric') + paths.seam = paths.leftSide + .clone() + .join(paths.bottom) + .join(paths.sideSeam) + .join(paths.waist) + .attr('class', 'fabric') - // Complete? - if (complete) { macro('grainline', { from: points.grainlineTop, to: points.grainlineBottom, @@ -61,12 +61,16 @@ function penelopeBack(params) { snippets.logo = new Snippet('logo', points.logoAnchor) + store.cutlist.addCut({ + cut: options.backVent == false && options.zipperLocation != 'backSeam' ? 1 : 2, + from: 'fabric', + }) + if (options.backVent == false && options.zipperLocation != 'backSeam') { macro('cutonfold', { from: points.lWaist, to: points.lLeg, - margin: 5, - offset: 10, + id: 'back', }) } macro('title', { @@ -94,47 +98,58 @@ function penelopeBack(params) { .attr('class', 'fabric sa') } } - } - if (paperless) { if (options.backVent) { - macro('hd', { - from: points.vHem, - to: points.rHem, - y: points.rHem.y - options.paperlessOffset - sa, - }) macro('hd', { from: points.vTop, to: points.lVent, y: points.vTop.y, + id: 'ventWidth', + noStartMarker: true, + noEndMarker: true, }) macro('vd', { from: points.lSeat, to: points.lVent, x: points.lWaist.x - options.paperlessOffset - sa, + id: 'seatToVent', }) macro('vd', { from: points.lVent, to: points.vTop, x: points.lVent.x, + id: 'ventDiagonalHeight', + noStartMarker: true, + noEndMarker: true, + }) + macro('hd', { + from: points.vLeg, + to: points.rLeg, + y: points.rHem.y + sa + options.paperlessOffset, + id: 'legWidth', + }) + macro('hd', { + from: points.vHem, + to: points.rHem, + y: points.rHem.y + sa + options.paperlessOffset * 2, + id: 'hemWidth', }) } else { + macro('hd', { + from: points.lLeg, + to: points.rLeg, + y: points.rHem.y + sa + options.paperlessOffset, + id: 'legWidth', + }) macro('hd', { from: points.lHem, to: points.rHem, - y: points.rHem.y - options.paperlessOffset - sa, + y: points.rHem.y + sa + options.paperlessOffset * 2, + id: 'hemWidth', }) } - } - return part -} - -export const back = { - name: 'penelope.back', - measurements, - optionalMeasurements, - options, - draft: penelopeBack, + return part + }, } diff --git a/designs/penelope/src/front.mjs b/designs/penelope/src/front.mjs index cd4b0d0f985..993e746fbdf 100644 --- a/designs/penelope/src/front.mjs +++ b/designs/penelope/src/front.mjs @@ -1,25 +1,26 @@ import { measurements, optionalMeasurements, options, BuildMainShape } from './shape.mjs' -function penelopeFront(params) { - const { options, Path, points, paths, Snippet, snippets, complete, sa, paperless, macro, part } = - params +export const front = { + name: 'penelope.front', + measurements, + optionalMeasurements, + options, + draft: (params) => { + const { options, Path, points, paths, Snippet, snippets, sa, macro, store, part } = params - BuildMainShape(params, true) + BuildMainShape(params, true) - paths.seam = paths.leftSide - .clone() - .join(paths.bottom) - .join(paths.sideSeam) - .join(paths.waist) - .attr('class', 'fabric') + paths.seam = paths.leftSide + .clone() + .join(paths.bottom) + .join(paths.sideSeam) + .join(paths.waist) + .attr('class', 'fabric') - // Complete? - if (complete) { macro('cutonfold', { from: points.lWaist, to: points.lLeg, - margin: 5, - offset: 10, + id: 'front', }) macro('title', { nr: 1, @@ -36,6 +37,8 @@ function penelopeFront(params) { snippets.logo = new Snippet('logo', points.logoAnchor) + store.cutlist.addCut({ cut: 1, from: 'fabric' }) + if (sa) { paths.sa = new Path() .move(points.lHem) @@ -44,22 +47,19 @@ function penelopeFront(params) { .attr('class', 'fabric sa') } - if (paperless) { - macro('hd', { - from: points.lHem, - to: points.rHem, - y: points.rHem.y - options.paperlessOffset, - }) - } - } + macro('hd', { + from: points.lLeg, + to: points.rLeg, + y: points.rHem.y + sa + options.paperlessOffset, + id: 'legWidth', + }) + macro('hd', { + from: points.lHem, + to: points.rHem, + y: points.rHem.y + sa + options.paperlessOffset * 2, + id: 'hemWidth', + }) - return part -} - -export const front = { - name: 'penelope.front', - measurements, - optionalMeasurements, - options, - draft: penelopeFront, + return part + }, } diff --git a/designs/penelope/src/shape.mjs b/designs/penelope/src/shape.mjs index 23e9ff4ad4a..44effc8c4c1 100644 --- a/designs/penelope/src/shape.mjs +++ b/designs/penelope/src/shape.mjs @@ -1,3 +1,4 @@ +import { pctBasedOn } from '@freesewing/core' import { addDartToCurve, dartCalc } from './utils.mjs' export const measurements = ['waist', 'seat', 'waistToHips', 'waistToSeat', 'waistToKnee'] @@ -23,32 +24,53 @@ export const options = { curvedDartTopControlOffset: 0.2, curvedDartBottomControlOffset: 0.4, curvedDarts: { bool: true, menu: 'style' }, - lengthBonus: { pct: 0, min: -50, max: 50, menu: 'style' }, - hemBonus: { pct: 0, min: -35, max: 0, menu: 'style' }, - hem: { pct: 2, min: 0, max: 5, menu: 'style' }, + lengthBonus: { pct: 0, min: -50, max: 50, ...pctBasedOn('waistToKnee'), menu: 'style' }, + hemBonus: { pct: 0, min: -35, max: 0, ...pctBasedOn('seat'), menu: 'style' }, + hem: { pct: 2, min: 0, max: 5, ...pctBasedOn('waistToKnee'), menu: 'style' }, backVent: { bool: true, menu: 'style' }, - backVentLength: { pct: 40, min: 5, max: 70, menu: 'style' }, + backVentLength: { + pct: 40, + min: 5, + max: 70, + // eslint-disable-next-line no-unused-vars + toAbs: (value, { measurements, options }, mergedOptions) => + value * (measurements.waistToKnee * (1 + options.lengthBonus)), + // eslint-disable-next-line no-unused-vars + menu: (settings, mergedOptions) => (settings?.options?.backVent === false ? false : 'style'), + }, zipperLocation: { dflt: 'backSeam', list: ['backSeam', 'sideSeam'], menu: 'style' }, nrOfDarts: { count: 2, min: 1, max: 2, menu: 'style' }, - seatEase: { pct: 1, min: 0, max: 8, menu: 'fit' }, - waistEase, - backDartDepthFactor: { pct: 50, min: 35, max: 70, menu: 'advanced' }, - frontDartDepthFactor: { pct: 45, min: 30, max: 65, menu: 'advanced' }, + seatEase: { pct: 1, min: 0, max: 8, ...pctBasedOn('seat'), menu: 'fit' }, + waistEase: { pct: 1, min: 0, max: 8, ...pctBasedOn('waist'), menu: 'fit' }, + backDartDepthFactor: { + pct: 50, + min: 35, + max: 70, + ...pctBasedOn('waistToSeat'), + menu: 'advanced', + }, + frontDartDepthFactor: { + pct: 45, + min: 30, + max: 65, + ...pctBasedOn('waistToSeat'), + menu: 'advanced', + }, dartToSideSeamFactor: { pct: 50, min: 30, max: 70, menu: 'advanced' }, } export function BuildMainShape( - { sa, options, measurements, Point, Path, points, paths, store, paperless, macro, part, log }, + { sa, options, measurements, Point, Path, points, paths, store, macro, part, log }, frontPart ) { - let skirtLength = measurements.waistToKnee * (1 + options.lengthBonus) // + options.hem; + const skirtLength = measurements.waistToKnee * (1 + options.lengthBonus) // + options.hem; store.set('skirtLength', skirtLength) store.set('waistEase', measurements.waist * options.waistEase) store.set('seatEase', measurements.seat * options.seatEase) store.set('hem', measurements.waistToKnee * options.hem) - let dartDepthFactor = frontPart ? options.frontDartDepthFactor : options.backDartDepthFactor + const dartDepthFactor = frontPart ? options.frontDartDepthFactor : options.backDartDepthFactor let waist = measurements.waist let seat = measurements.seat > waist ? measurements.seat : waist @@ -85,7 +107,7 @@ export function BuildMainShape( seat += store.get('seatEase') waist += store.get('waistEase') - let sideSeam = seat / 4 //+ sideSeamShift + const sideSeam = seat / 4 //+ sideSeamShift points.lWaist = new Point(0, 0) points.lLeg = new Point(0, skirtLength) @@ -246,12 +268,14 @@ export function BuildMainShape( // Create the inverse of the curve from the leg to the waist // Then split it at the hem level points.lHem = points.lLeg.shift(270, store.get('hem')) - let rInverseSeat = points.rSeat.shift(270, (points.rLeg.y - points.rSeat.y) * 2) - let rInverseSeatCP = rInverseSeat.shift(90, points.rSeatCPdown.y - points.rSeat.y) - let rInversePath = new Path().move(rInverseSeat).curve(rInverseSeatCP, points.rLeg, points.rLeg) + const rInverseSeat = points.rSeat.shift(270, (points.rLeg.y - points.rSeat.y) * 2) + const rInverseSeatCP = rInverseSeat.shift(90, points.rSeatCPdown.y - points.rSeat.y) + const rInversePath = new Path() + .move(rInverseSeat) + .curve(rInverseSeatCP, points.rLeg, points.rLeg) points.rHem = rInversePath.intersectsY(points.lHem.y)[0] - let sideSeamHemPath = rInversePath.split(points.rHem)[1] + const sideSeamHemPath = rInversePath.split(points.rHem)[1] sideSeamPath = sideSeamHemPath.join(sideSeamPath) @@ -270,114 +294,144 @@ export function BuildMainShape( points.titleAnchor = new Point(measurements.waist / 6, measurements.waistToSeat) points.logoAnchor = points.titleAnchor.shift(270, 75) + points.gridAnchor = points.logoAnchor.clone() points.grainlineTop = points.lWaist.shift(0, 50).shift(270, 50) points.grainlineBottom = points.lLeg.shift(0, 50).shift(90, 50) - if (paperless) { - macro('hd', { - from: points.lSeat, - to: points.rSeat, - y: points.rSeat.y, - }) + macro('hd', { + from: points.lSeat, + to: points.rSeat, + y: points.rSeat.y, + id: 'seatWidth', + }) + macro('vd', { + from: points.lWaist, + to: points.rWaist, + x: points.rWaist.x + options.paperlessOffset + sa, + id: 'sideWaistHeight', + noStartMarker: true, + noEndMarker: true, + }) + macro('vd', { + from: points.lWaist, + to: points.lLeg, + x: points.lLeg.x + options.paperlessOffset + sa, + id: 'heightToHem', + }) + if (store.get('hem') > 0) { macro('vd', { - from: points.lWaist, - to: points.rWaist, - x: points.rWaist.x + options.paperlessOffset + sa, - }) - macro('vd', { - from: points.lWaist, - to: points.lLeg, + from: points.lLeg, + to: points.lHem, x: points.lLeg.x + options.paperlessOffset + sa, + id: 'heightHem', + noStartMarker: true, + noEndMarker: true, }) - if (store.get('hem') > 0) { - macro('vd', { - from: points.lLeg, - to: points.lHem, - x: points.lLeg.x + options.paperlessOffset + sa, - }) - } + } - if (store.get('nrOfDarts') > 0) { + if (store.get('nrOfDarts') > 0) { + macro('hd', { + from: points.lWaist, + to: points.dart1Middle, + y: points.dart1Middle.y, + id: 'dart1Middle', + }) + macro('hd', { + from: points.lWaist, + to: points.dart1Start, + y: points.dart1Start.y - options.paperlessOffset - sa, + id: 'middleToDart1', + }) + macro('hd', { + from: points.dart1Start, + to: points.dart1End, + y: points.dart1End.y - options.paperlessOffset - sa, + id: 'widthDart1', + noStartMarker: true, + noEndMarker: true, + }) + if (store.get('nrOfDarts') > 1) { macro('hd', { from: points.lWaist, - to: points.dart1Middle, - y: points.dart1Middle.y, + to: points.dart2Middle, + y: points.dart2Middle.y, + id: 'middleToDart2', }) macro('hd', { - from: points.lWaist, - to: points.dart1Start, - y: points.dart1Start.y - options.paperlessOffset - sa, + from: points.dart1End, + to: points.dart2Start, + y: points.dart2Start.y - options.paperlessOffset - sa, + id: 'dart1toDart2', + noStartMarker: true, + noEndMarker: true, }) macro('hd', { - from: points.dart1Start, - to: points.dart1End, - y: points.dart1End.y - options.paperlessOffset - sa, + from: points.dart2Start, + to: points.dart2End, + y: points.dart2End.y - options.paperlessOffset - sa, + id: 'widthDart2', + noStartMarker: true, + noEndMarker: true, }) - if (store.get('nrOfDarts') > 1) { - macro('hd', { - from: points.lWaist, - to: points.dart2Middle, - y: points.dart2Middle.y, - }) - macro('hd', { - from: points.dart1End, - to: points.dart2Start, - y: points.dart2Start.y - options.paperlessOffset - sa, - }) - macro('hd', { - from: points.dart2Start, - to: points.dart2End, - y: points.dart2End.y - options.paperlessOffset - sa, - }) - macro('hd', { - from: points.dart2End, - to: points.rWaist, - y: points.rWaist.y - options.paperlessOffset - sa, - }) - macro('vd', { - from: points.lWaist, - to: points.dart2Middle, - x: points.lWaist.x - options.paperlessOffset - sa, - }) - macro('vd', { - from: points.dart2Middle, - to: points.dart1Middle, - x: points.lWaist.x - options.paperlessOffset - sa, - }) - macro('vd', { - from: points.dart1Middle, - to: points.lSeat, - x: points.lWaist.x - options.paperlessOffset - sa, - }) - } else { - macro('vd', { - from: points.lWaist, - to: points.dart1Middle, - x: points.lWaist.x - options.paperlessOffset - sa, - }) - macro('hd', { - from: points.dart1End, - to: points.rWaist, - y: points.rWaist.y - options.paperlessOffset - sa, - }) - macro('vd', { - from: points.dart1Middle, - to: points.lSeat, - x: points.lWaist.x - options.paperlessOffset - sa, - }) - } - } else { macro('hd', { - from: points.lWaist, + from: points.dart2End, to: points.rWaist, y: points.rWaist.y - options.paperlessOffset - sa, + id: 'dart2toSide', }) macro('vd', { from: points.lWaist, + to: points.dart2Middle, + x: points.lWaist.x - options.paperlessOffset - sa, + id: 'heightDart2', + }) + macro('vd', { + from: points.dart2Middle, + to: points.dart1Middle, + x: points.lWaist.x - options.paperlessOffset - sa, + id: 'heightDart1toDart2', + noStartMarker: true, + noEndMarker: true, + }) + macro('vd', { + from: points.dart1Middle, to: points.lSeat, x: points.lWaist.x - options.paperlessOffset - sa, + id: 'dart1ToSeat', + }) + } else { + macro('vd', { + from: points.lWaist, + to: points.dart1Middle, + x: points.lWaist.x - options.paperlessOffset - sa, + id: 'heightDart1', + }) + macro('hd', { + from: points.dart1End, + to: points.rWaist, + y: points.rWaist.y - options.paperlessOffset - sa, + id: 'dart1toSide', + }) + macro('vd', { + from: points.dart1Middle, + to: points.lSeat, + x: points.lWaist.x - options.paperlessOffset - sa, + id: 'dart1toSeat', }) } + } else { + macro('hd', { + from: points.lWaist, + to: points.rWaist, + y: points.rWaist.y - options.paperlessOffset - sa, + id: 'waistWidth', + }) + macro('vd', { + from: points.lWaist, + to: points.lSeat, + x: points.lWaist.x - options.paperlessOffset - sa, + id: 'waistToSeat', + }) } } diff --git a/designs/penelope/src/utils.mjs b/designs/penelope/src/utils.mjs index 4d9fba5d6c6..6e9ade6861b 100644 --- a/designs/penelope/src/utils.mjs +++ b/designs/penelope/src/utils.mjs @@ -27,7 +27,7 @@ function dartCalcBack(options, seatWaistDiff, waist, nrOfDarts) { function dartCalc(store, options, seat, seatEase, waist, waistEase) { seat += seatEase waist += waistEase - let seatWaistDiff = Math.max(seat - waist, 0) + const seatWaistDiff = Math.max(seat - waist, 0) let nrOfDarts = options.nrOfDarts @@ -81,41 +81,41 @@ function addDartToCurve(part, curvePath, distance, dartSize, dartDepth) { if (curvePath.length() - distance < dartSize) { distance = curvePath.length() - dartSize / 1.95 } - let dartMiddle = curvePath.shiftAlong(distance) - let curvePaths = curvePath.split(dartMiddle) + const dartMiddle = curvePath.shiftAlong(distance) + const curvePaths = curvePath.split(dartMiddle) if (curvePaths[0].length() < dartSize / 2 || curvePaths[1].length() < dartSize / 2) { // Curve too small to fit dart! return null } - let dartLeft = curvePaths[0].reverse().shiftAlong(dartSize / 2) - let dartRight = curvePaths[1].shiftAlong(dartSize / 2) + const dartLeft = curvePaths[0].reverse().shiftAlong(dartSize / 2) + const dartRight = curvePaths[1].shiftAlong(dartSize / 2) - let distanceFactor = 0.0015 - let leftCPdistance = Math.min( + const distanceFactor = 0.0015 + const leftCPdistance = Math.min( curvePaths[0].length() * distanceFactor, curvePaths[0].ops[1].to.dist(curvePaths[0].ops[1].cp2) ) - let rightCPdistance = Math.min( + const rightCPdistance = Math.min( curvePaths[1].length() * distanceFactor, curvePaths[1].ops[0].to.dist(curvePaths[1].ops[1].cp1) ) - let dartBottom = dartMiddle.shift(dartLeft.angle(dartRight) - 90, dartDepth) + const dartBottom = dartMiddle.shift(dartLeft.angle(dartRight) - 90, dartDepth) - let leftDartCP = dartLeft.shift(dartLeft.angle(dartBottom) - 90, leftCPdistance) - let rightDartCP = dartRight.shift(dartRight.angle(dartBottom) + 90, rightCPdistance) + const leftDartCP = dartLeft.shift(dartLeft.angle(dartBottom) - 90, leftCPdistance) + const rightDartCP = dartRight.shift(dartRight.angle(dartBottom) + 90, rightCPdistance) - let curveLeftOfDart = new part.Path() + const curveLeftOfDart = new part.Path() .move(curvePaths[0].ops[0].to) .curve(curvePaths[0].ops[1].cp1, leftDartCP, dartLeft) .hide() - let curveRightOfDart = new part.Path() + const curveRightOfDart = new part.Path() .move(dartRight) .curve(rightDartCP, curvePaths[1].ops[1].cp2, curvePaths[1].ops[1].to) .hide() - let dart + let dart = null if (options.curvedDarts) { if ( dartBottom.angle(dartLeft) - dartBottom.angle(dartRight) < @@ -123,17 +123,17 @@ function addDartToCurve(part, curvePath, distance, dartSize, dartDepth) { ) { dart = new part.Path().move(dartLeft).line(dartBottom).line(dartRight).hide() } else { - let dartBottomCp2 = dartBottom + const dartBottomCp2 = dartBottom .shiftFractionTowards(dartMiddle, options.curvedDartBottomControlOffset) .rotate(options.curvedDartControlAngle, dartBottom) - let dartBottomCp1 = dartBottom + const dartBottomCp1 = dartBottom .shiftFractionTowards(dartMiddle, options.curvedDartBottomControlOffset) .rotate(360 - options.curvedDartControlAngle, dartBottom) - let dartLeftCp1 = dartLeft.shiftFractionTowards( + const dartLeftCp1 = dartLeft.shiftFractionTowards( dartBottom, options.curvedDartTopControlOffset ) - let dartRightCp2 = dartRight.shiftFractionTowards( + const dartRightCp2 = dartRight.shiftFractionTowards( dartBottom, options.curvedDartTopControlOffset ) @@ -148,7 +148,7 @@ function addDartToCurve(part, curvePath, distance, dartSize, dartDepth) { dart = new part.Path().move(dartLeft).line(dartBottom).line(dartRight).hide() } - let curveWithDart = { + const curveWithDart = { left: curveLeftOfDart, dart: dart, right: curveRightOfDart, diff --git a/designs/penelope/src/waistband.mjs b/designs/penelope/src/waistband.mjs index 28b1d3fba0b..84dba32b3d2 100644 --- a/designs/penelope/src/waistband.mjs +++ b/designs/penelope/src/waistband.mjs @@ -1,56 +1,106 @@ -import { waistEase } from './shape.mjs' +import { pctBasedOn } from '@freesewing/core' +import { options } from './shape.mjs' -function penelopeWaistband({ - options, - measurements, - Point, - Path, - points, - paths, - Snippet, - snippets, - complete, - sa, - paperless, - macro, - store, - part, -}) { - if (!options.waistBand) return part.hide() +const { waistEase } = options - let waist = measurements.waist - waist += measurements.waist * options.waistEase - store.set('waistBandWidth', options.waistBandWidth * measurements.waistToKnee) +export const waistband = { + name: 'penelope.waistband', + measurements: ['waist', 'waistToKnee'], + options: { + waistEase, + waistband: { bool: true, menu: 'style' }, + waistbandWidth: { + pct: 10, + min: 5, + max: 20, + ...pctBasedOn('waistToKnee'), + // eslint-disable-next-line no-unused-vars + menu: (settings, mergedOptions) => (settings?.options?.waistband === false ? false : 'style'), + }, + waistbandOverlap: { + pct: 3.5, + min: 0, + max: 10, + ...pctBasedOn('waist'), + // eslint-disable-next-line no-unused-vars + menu: (settings, mergedOptions) => (settings?.options?.waistband === false ? false : 'style'), + }, + }, + draft: ({ + options, + measurements, + Point, + Path, + points, + paths, + Snippet, + snippets, + sa, + macro, + store, + expand, + units, + part, + }) => { + if (!options.waistband) return part.hide() - points.TL = new Point(0, 0) - points.BL = new Point(0, waist / 2 + options.waistBandOverlap) - points.TR = new Point(store.get('waistBandWidth'), 0) - points.BR = new Point(store.get('waistBandWidth'), waist / 2 + options.waistBandOverlap) + let waist = measurements.waist + waist += measurements.waist * options.waistEase + const waistbandWidth = options.waistbandWidth * measurements.waistToKnee + const waistbandLength = waist / 2 + measurements.waist * options.waistbandOverlap + store.set('waistbandWidth', waistbandWidth) - points.titleAnchor = new Point(store.get('waistBandWidth') / 2, waist / 6) - points.logoAnchor = new Point(store.get('waistBandWidth') / 2, waist / 3) + if (!expand) { + // Expand is on, do not draw the part but flag this to the user + store.flag.note({ + msg: `penelope:cutWaistband`, + replace: { + width: units(waistbandLength), + length: units(waistbandWidth), + }, + suggest: { + text: 'flag:show', + icon: 'expand', + update: { + settings: ['expand', 1], + }, + }, + }) + // Also hint about expand + store.flag.preset('expand') - paths.outline = new Path() - .move(points.TL) - .line(points.BL) - .line(points.BR) - .line(points.TR) - .line(points.TL) - .close() - .attr('class', 'fabric') + return part.hide() + } + + points.TL = new Point(0, 0) + points.BL = new Point(0, waist / 2 + options.waistbandOverlap) + points.TR = new Point(waistbandWidth, 0) + points.BR = new Point(waistbandWidth, waist / 2 + options.waistbandOverlap) + + points.titleAnchor = new Point(waistbandWidth / 2, waist / 6) + points.logoAnchor = new Point(waistbandWidth / 2, waist / 3) + points.gridAnchor = points.logoAnchor.clone() + + paths.outline = new Path() + .move(points.TL) + .line(points.BL) + .line(points.BR) + .line(points.TR) + .line(points.TL) + .close() + .attr('class', 'fabric') - // Complete? - if (complete) { macro('cutonfold', { from: points.TR, to: points.TL, - margin: 15, - offset: 15, grainline: true, + reverse: true, }) snippets.logo = new Snippet('logo', points.logoAnchor) + store.cutlist.addCut({ cut: 1, from: 'fabric' }) + macro('title', { nr: 3, at: points.titleAnchor, @@ -66,32 +116,20 @@ function penelopeWaistband({ .line(points.TR) .attr('class', 'fabric sa') } - } - if (paperless) { macro('vd', { from: points.TL, to: points.BL, x: points.TL.x + options.paperlessOffset, + id: 'height', }) macro('hd', { from: points.BL, to: points.BR, y: points.BR.y - options.paperlessOffset, + id: 'width', }) - } - return part -} - -export const waistband = { - name: 'penelope.waistband', - measurements: ['waist', 'waistToKnee'], - options: { - waistEase, - waistBandOverlap: 25, - waistBand: { bool: true, menu: 'style' }, - waistBandWidth: { pct: 10, min: 5, max: 20, menu: 'style' }, + return part }, - draft: penelopeWaistband, } diff --git a/designs/plugintest/package.json b/designs/plugintest/package.json index 31137e433e9..f8736811c2d 100644 --- a/designs/plugintest/package.json +++ b/designs/plugintest/package.json @@ -65,7 +65,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/rendertest/package.json b/designs/rendertest/package.json index c7aaa0eb00e..b49e0fe0cd3 100644 --- a/designs/rendertest/package.json +++ b/designs/rendertest/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/sandy/package.json b/designs/sandy/package.json index 0bf1e57dd1d..e7f88fb99c1 100644 --- a/designs/sandy/package.json +++ b/designs/sandy/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/shin/package.json b/designs/shin/package.json index 9efbec4f56c..e44cc1b1e18 100644 --- a/designs/shin/package.json +++ b/designs/shin/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/simon/package.json b/designs/simon/package.json index f2a4d611729..6bae6892bdb 100644 --- a/designs/simon/package.json +++ b/designs/simon/package.json @@ -57,7 +57,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/simone/package.json b/designs/simone/package.json index 956ca6c25a0..9d90fe164f5 100644 --- a/designs/simone/package.json +++ b/designs/simone/package.json @@ -58,7 +58,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/sven/package.json b/designs/sven/package.json index e7ba066bf06..85cb7082dd2 100644 --- a/designs/sven/package.json +++ b/designs/sven/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/tamiko/package.json b/designs/tamiko/package.json index 5c07a55deba..6cb533f7cba 100644 --- a/designs/tamiko/package.json +++ b/designs/tamiko/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/teagan/package.json b/designs/teagan/package.json index 440c4a111b0..1dba4463c77 100644 --- a/designs/teagan/package.json +++ b/designs/teagan/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/tiberius/package.json b/designs/tiberius/package.json index 5fed0705a5a..dc7b9fed64f 100644 --- a/designs/tiberius/package.json +++ b/designs/tiberius/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/titan/package.json b/designs/titan/package.json index b0375354db2..7447bfd8e1b 100644 --- a/designs/titan/package.json +++ b/designs/titan/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/trayvon/package.json b/designs/trayvon/package.json index be893171bdd..16b1efb58c5 100644 --- a/designs/trayvon/package.json +++ b/designs/trayvon/package.json @@ -55,7 +55,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/tutorial/package.json b/designs/tutorial/package.json index 5e9febd3084..15f8ac71cbc 100644 --- a/designs/tutorial/package.json +++ b/designs/tutorial/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/uma/package.json b/designs/uma/package.json index 35f39e9829c..012f04b5843 100644 --- a/designs/uma/package.json +++ b/designs/uma/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/wahid/package.json b/designs/wahid/package.json index aa56b40ad87..15fae19ff62 100644 --- a/designs/wahid/package.json +++ b/designs/wahid/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/walburga/package.json b/designs/walburga/package.json index a0fd07293b8..0bd2d29ca03 100644 --- a/designs/walburga/package.json +++ b/designs/walburga/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/waralee/package.json b/designs/waralee/package.json index 9cbe12f7d83..92e0b68b490 100644 --- a/designs/waralee/package.json +++ b/designs/waralee/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/designs/yuri/package.json b/designs/yuri/package.json index 6289a4423a2..67db85bbbba 100644 --- a/designs/yuri/package.json +++ b/designs/yuri/package.json @@ -56,7 +56,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/models": "3.0.0-alpha.10", "@freesewing/plugin-timing": "3.0.0-alpha.10" }, diff --git a/markdown/org/docs/designs/penelope/options/curveddarts/en.md b/markdown/org/docs/designs/penelope/options/curveddarts/en.md new file mode 100644 index 00000000000..289636b06c7 --- /dev/null +++ b/markdown/org/docs/designs/penelope/options/curveddarts/en.md @@ -0,0 +1,11 @@ +--- +title: "Curved darts" +--- + +The darts can be straight, or curved. Straight darts is what you see in most +pencil skirt patterns. Curved darts shape the top of the skirt slightly, hopefully +giving a better fit. + +## Effect of this option on the pattern + + diff --git a/markdown/org/docs/designs/penelope/options/waistbandoverlap/en.md b/markdown/org/docs/designs/penelope/options/waistbandoverlap/en.md new file mode 100644 index 00000000000..53cac0c64f1 --- /dev/null +++ b/markdown/org/docs/designs/penelope/options/waistbandoverlap/en.md @@ -0,0 +1,10 @@ +--- +title: "Waist band overlap" +--- + +The width of the overlap by the zipper. This is normally used to hide snaps, buttons, or hooks that +reinforce the zipper at the waistband. + +## Effect of this option on the pattern + + diff --git a/packages/core/package.json b/packages/core/package.json index 1533abbc7b9..73396378407 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -63,11 +63,11 @@ "lodash.clonedeep": "^4.5.0" }, "devDependencies": { - "eslint": "8.48.0", + "eslint": "8.50.0", "nyc": "15.1.0", "mocha": "10.2.0", - "chai": "4.3.7", - "sinon": "^15.0.1" + "chai": "4.3.9", + "sinon": "^16.0.0" }, "files": [ "dist/*", diff --git a/plugins/core-plugins/package.json b/plugins/core-plugins/package.json index 088b82e3c77..8b12ad318f4 100644 --- a/plugins/core-plugins/package.json +++ b/plugins/core-plugins/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7", + "chai": "4.3.9", "@freesewing/plugin-annotations": "3.0.0-alpha.10", "@freesewing/plugin-mirror": "3.0.0-alpha.10", "@freesewing/plugin-round": "3.0.0-alpha.10", diff --git a/plugins/plugin-annotations/package.json b/plugins/plugin-annotations/package.json index ed58782eef3..76d0817b0a3 100644 --- a/plugins/plugin-annotations/package.json +++ b/plugins/plugin-annotations/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-bust/package.json b/plugins/plugin-bust/package.json index 7bfd067970f..e83cdf7d4f5 100644 --- a/plugins/plugin-bust/package.json +++ b/plugins/plugin-bust/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-flip/package.json b/plugins/plugin-flip/package.json index 220cc795249..2e916fef904 100644 --- a/plugins/plugin-flip/package.json +++ b/plugins/plugin-flip/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-gore/package.json b/plugins/plugin-gore/package.json index 23468d6ab44..7a57c402059 100644 --- a/plugins/plugin-gore/package.json +++ b/plugins/plugin-gore/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-i18n/package.json b/plugins/plugin-i18n/package.json index 12b06336883..fc0563ceb9b 100644 --- a/plugins/plugin-i18n/package.json +++ b/plugins/plugin-i18n/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-measurements/package.json b/plugins/plugin-measurements/package.json index ebed9f51916..6a54b34fcaf 100644 --- a/plugins/plugin-measurements/package.json +++ b/plugins/plugin-measurements/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-mirror/package.json b/plugins/plugin-mirror/package.json index 29a2e05b60e..4e749b5c094 100644 --- a/plugins/plugin-mirror/package.json +++ b/plugins/plugin-mirror/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-round/package.json b/plugins/plugin-round/package.json index dbe94a0c300..75bf03ae44c 100644 --- a/plugins/plugin-round/package.json +++ b/plugins/plugin-round/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-sprinkle/package.json b/plugins/plugin-sprinkle/package.json index bdc63b9e54a..8469a94b439 100644 --- a/plugins/plugin-sprinkle/package.json +++ b/plugins/plugin-sprinkle/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-svgattr/package.json b/plugins/plugin-svgattr/package.json index 3c89dad5d4e..d323f4646e3 100644 --- a/plugins/plugin-svgattr/package.json +++ b/plugins/plugin-svgattr/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-theme/package.json b/plugins/plugin-theme/package.json index 1edac4f5c90..e47c7703d16 100644 --- a/plugins/plugin-theme/package.json +++ b/plugins/plugin-theme/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-timing/package.json b/plugins/plugin-timing/package.json index 5351e012b8b..881e2c6e91e 100644 --- a/plugins/plugin-timing/package.json +++ b/plugins/plugin-timing/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/plugins/plugin-versionfree-svg/package.json b/plugins/plugin-versionfree-svg/package.json index aa060b58efb..bae6e7c92bf 100644 --- a/plugins/plugin-versionfree-svg/package.json +++ b/plugins/plugin-versionfree-svg/package.json @@ -54,7 +54,7 @@ "dependencies": {}, "devDependencies": { "mocha": "10.2.0", - "chai": "4.3.7" + "chai": "4.3.9" }, "files": [ "dist/*", diff --git a/sites/backend/package.json b/sites/backend/package.json index 59b85310f8e..84bb4aaa632 100644 --- a/sites/backend/package.json +++ b/sites/backend/package.json @@ -48,7 +48,7 @@ "swagger-ui-express": "5.0.0" }, "devDependencies": { - "chai": "4.3.7", + "chai": "4.3.9", "chai-http": "4.4.0", "esbuild": "0.19.2", "mocha": "10.2.0", diff --git a/sites/shared/components/designs/info.mjs b/sites/shared/components/designs/info.mjs index a40a870fbef..84cdc2f2cc5 100644 --- a/sites/shared/components/designs/info.mjs +++ b/sites/shared/components/designs/info.mjs @@ -80,10 +80,10 @@ export const DesignInfo = ({ design, docs = false }) => { // Translate measurements const measies = { required: {}, optional: {} } - if (config.measurements) { + if (config?.measurements) { for (const m of config.measurements) measies.required[m] = t(`measurements:${m}`) } - if (config.optionalMeasurements) { + if (config?.optionalMeasurements) { for (const m of config.optionalMeasurements) measies.optional[m] = t(`measurements:${m}`) } diff --git a/yarn.lock b/yarn.lock index 338155df37e..80904464796 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1206,10 +1206,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.48.0": - version "8.48.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.48.0.tgz#642633964e217905436033a2bd08bf322849b7fb" - integrity sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw== +"@eslint/js@8.50.0": + version "8.50.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" + integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== "@headlessui/react@1.7.17": version "1.7.17" @@ -1218,10 +1218,10 @@ dependencies: client-only "^0.0.1" -"@humanwhocodes/config-array@^0.11.10": - version "0.11.10" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" - integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== +"@humanwhocodes/config-array@^0.11.11": + version "0.11.11" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" + integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -3889,13 +3889,13 @@ chai-string@^1.5.0: resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.5.0.tgz#0bdb2d8a5f1dbe90bc78ec493c1c1c180dd4d3d2" integrity sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw== -chai@4.3.7, chai@^4.2.0: - version "4.3.7" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" - integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== +chai@4.3.9, chai@^4.2.0: + version "4.3.9" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.9.tgz#c934ab542b11cc933a963617f0f890274c66c042" + integrity sha512-tH8vhfA1CfuYMkALXj+wmZcqiwqOfshU9Gry+NYiiLqIddrobkBhALv6XD4yDz68qapphYI4vSaqhqAdThCAAA== dependencies: assertion-error "^1.1.0" - check-error "^1.0.2" + check-error "^1.0.3" deep-eql "^4.1.2" get-func-name "^2.0.0" loupe "^2.3.1" @@ -4011,10 +4011,12 @@ charset@^1.0.1: resolved "https://registry.yarnpkg.com/charset/-/charset-1.0.1.tgz#8d59546c355be61049a8fa9164747793319852bd" integrity sha512-6dVyOOYjpfFcL1Y4qChrAoQLRHvj2ziyhcm0QJlhOcAhykL/k1kTUPbeo+87MNRTRdk2OIIsIXbuF3x2wi5EXg== -check-error@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" - integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== +check-error@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" + integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== + dependencies: + get-func-name "^2.0.2" cheerio-select@^2.1.0: version "2.1.0" @@ -5896,16 +5898,16 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@8.48.0, eslint@^8.23.1, eslint@^8.41.0: - version "8.48.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.48.0.tgz#bf9998ba520063907ba7bfe4c480dc8be03c2155" - integrity sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg== +eslint@8.50.0, eslint@^8.23.1, eslint@^8.41.0: + version "8.50.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" + integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" "@eslint/eslintrc" "^2.1.2" - "@eslint/js" "8.48.0" - "@humanwhocodes/config-array" "^0.11.10" + "@eslint/js" "8.50.0" + "@humanwhocodes/config-array" "^0.11.11" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" ajv "^6.12.4" @@ -6610,10 +6612,10 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" - integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== +get-func-name@^2.0.0, get-func-name@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" + integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1: version "1.2.1"