diff --git a/designs/hugo/i18n/en.json b/designs/hugo/i18n/en.json index f9dcc237814..3225047639c 100644 --- a/designs/hugo/i18n/en.json +++ b/designs/hugo/i18n/en.json @@ -7,24 +7,21 @@ "front": "Front", "hoodCenter": "Hood center", "hoodSide": "Hood side", + "neckBinding": "Neck binding", "pocket": "Pocket", "pocketFacing": "Pocket facing", "sleeve": "Sleeve", "waistband": "Waistband" }, "s": { - "cuff": "Cuff", - "hoodCenter": "Hood center", - "hoodSide": "Hood side", - "pocketFacing": "Pocket facing", - "pocket": "Pocket", - "waistband": "Waistband", "cutPocket.t": "The pocket is not shown", "cutPocket.d": "The **Pocket** (4) is not shown, but you can trace it from the Front part (1), which has the pocket outline on it (not including seam allowance).", "cutCuff.t": "The cuff is not shown", "cutCuff.d": "The **Cuff** (9) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long.", "cutHoodCenter.t": "The hood center is not shown", "cutHoodCenter.d": "The **Hood center** (7) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long.", + "cutNeckBinding.t": "The neck binding is not shown", + "cutNeckBinding.d": "The **Neck Binding** (10) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long.", "cutWaistband.t": "The waistband is not shown", "cutWaistband.d": "The **Waistband** (8) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long" }, diff --git a/designs/hugo/src/index.mjs b/designs/hugo/src/index.mjs index fbdd66a0767..4aa759a0776 100644 --- a/designs/hugo/src/index.mjs +++ b/designs/hugo/src/index.mjs @@ -11,11 +11,23 @@ import { hoodSide } from './hoodside.mjs' import { hoodCenter } from './hoodcenter.mjs' import { waistband } from './waistband.mjs' import { cuff } from './cuff.mjs' +import { neckBinding } from './neckbinding.mjs' // Setup our new design const Hugo = new Design({ data, - parts: [back, front, sleeve, pocket, pocketFacing, hoodSide, hoodCenter, waistband, cuff], + parts: [ + back, + front, + sleeve, + pocket, + pocketFacing, + hoodSide, + hoodCenter, + waistband, + cuff, + neckBinding, + ], }) // Merge translations @@ -32,6 +44,7 @@ export { hoodCenter, waistband, cuff, + neckBinding, Hugo, i18n, } diff --git a/designs/hugo/src/neckbinding.mjs b/designs/hugo/src/neckbinding.mjs new file mode 100644 index 00000000000..0de72bb2fc7 --- /dev/null +++ b/designs/hugo/src/neckbinding.mjs @@ -0,0 +1,97 @@ +import { front } from './front.mjs' +import { back } from './back.mjs' +import { hoodCenter } from './hoodcenter.mjs' + +function hugoNeckBinding({ store, sa, Point, points, Path, paths, macro, part, expand, units }) { + const length = + store.get('neckOpeningLenFront') * 2 + + store.get('neckOpeningLenBack') * 2 + + store.get('hoodCenterWidth') + const width = length / 44.2 + + if (expand) { + store.flag.preset('expandIsOn') + } else { + const extraSa = sa ? 2 * sa : 0 + store.flag.note({ + msg: `hugo:cutNeckBinding`, + notes: [sa ? 'flag:saIncluded' : 'flag:saExcluded', 'flag:partHiddenByExpand'], + replace: { + w: units(width + extraSa), + l: units(length + extraSa), + }, + suggest: { + text: 'flag:show', + icon: 'expand', + update: { + settings: ['expand', 1], + }, + }, + }) + // Also hint about expand + store.flag.preset('expandIsOff') + + return part.hide() + } + + points.topLeft = new Point(0, 0) + points.topRight = new Point(length, 0) + points.bottomRight = new Point(length, width) + points.bottomLeft = new Point(0, width) + + paths.seam = new Path() + .move(points.topLeft) + .line(points.bottomLeft) + .line(points.bottomRight) + .line(points.topRight) + .line(points.topLeft) + .close() + .attr('class', 'fabric') + + // Seam allowance + if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') + + // Cutlist + store.cutlist.setCut({ cut: 1, from: 'fabric' }) + + // Grainline + macro('grainline', { + from: points.topLeft + .shiftFractionTowards(points.topRight, 0.15) + .shiftFractionTowards(points.bottomLeft, 0.6), + to: points.topRight + .shiftFractionTowards(points.topLeft, 0.15) + .shiftFractionTowards(points.bottomRight, 0.6), + }) + + //title + points.title = new Point(length / 2, width * 3) + macro('title', { + at: points.title, + nr: 10, + title: 'neckBinding', + scale: 0.4, + }) + + // Dimensions + macro('hd', { + id: 'length', + from: points.bottomLeft, + to: points.bottomRight, + y: points.bottomLeft.y + sa + 15, + }) + macro('vd', { + id: 'width', + from: points.topRight, + to: points.bottomRight, + x: points.topRight.x + sa + 15, + }) + + return part +} + +export const neckBinding = { + name: 'hugo.neckBinding', + after: [front, back, hoodCenter], + draft: hugoNeckBinding, +}