From 7a456d4004800a9eae97a76076b5556c4b99b2b6 Mon Sep 17 00:00:00 2001 From: Benjamin Fan Date: Sat, 23 Nov 2024 23:42:05 -0800 Subject: [PATCH] fix(hugo): Add Collar Ease option to allow neck opening size adjustments --- designs/hugo/src/back.mjs | 2 + designs/hugo/src/front.mjs | 2 + designs/hugo/src/options.mjs | 2 +- designs/hugo/src/sleeve.mjs | 40 +++++++++++++++++++ .../hugo/options/collarease/readme.mdx | 12 ++++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 sites/orgdocs/docs/designs/hugo/options/collarease/readme.mdx diff --git a/designs/hugo/src/back.mjs b/designs/hugo/src/back.mjs index ed5053bc40c..8dec8b7ff22 100644 --- a/designs/hugo/src/back.mjs +++ b/designs/hugo/src/back.mjs @@ -34,6 +34,8 @@ function hugoBack({ const neckOpening = new Path() .move(points.cbNeck) .curve(points.cbNeck, points.neckCp2, points.neck) + const length = neckOpening.length() * 2 + store.set('front_neck_len', length) points.raglanTipBack = neckOpening.shiftFractionAlong(0.7) const neckOpeningParts = neckOpening.split(points.raglanTipBack) // Paths diff --git a/designs/hugo/src/front.mjs b/designs/hugo/src/front.mjs index a1e66b8828b..871b45019a9 100644 --- a/designs/hugo/src/front.mjs +++ b/designs/hugo/src/front.mjs @@ -61,6 +61,8 @@ function hugoFront({ const neckOpening = new Path() .move(points.cfNeck) .curve(points.cfNeckCp1, points.neckCp2, points.neck) + const length = neckOpening.length() * 2 + store.set('back_neck_len', length) points.raglanTipFront = neckOpening.shiftFractionAlong(0.8) const neckOpeningParts = neckOpening.split(points.raglanTipFront) diff --git a/designs/hugo/src/options.mjs b/designs/hugo/src/options.mjs index cdb7a7a17bd..4e5f0c411e5 100644 --- a/designs/hugo/src/options.mjs +++ b/designs/hugo/src/options.mjs @@ -1,4 +1,3 @@ -export const collarEase = 0.05 export const armholeDepthFactor = 0.5 export const shoulderEase = 0 export const shoulderSlopeReduction = 0 @@ -14,3 +13,4 @@ export const lengthBonus = { pct: 10, min: 0, max: 20, menu: 'style' } export const sleeveLengthBonus = { pct: 2, min: 0, max: 10, menu: 'style' } export const ribbingHeight = { pct: 10, min: 4, max: 20, menu: 'style' } export const pocketWidth = { pct: 50, min: 35, max: 65, menu: 'style' } +export const collarEase = { pct: 15, min: 0, max: 40, menu: 'fit' } diff --git a/designs/hugo/src/sleeve.mjs b/designs/hugo/src/sleeve.mjs index 4e33d322271..36500205515 100644 --- a/designs/hugo/src/sleeve.mjs +++ b/designs/hugo/src/sleeve.mjs @@ -17,6 +17,8 @@ function hugoSleeve({ options, measurements, macro, + log, + units, part, }) { // Top of raglan sleeve @@ -233,6 +235,44 @@ function hugoSleeve({ y: points.wristLeft.y + 15 + sa, }) + /* + * Check neck opening size and warn if necessary. + */ + const sleeve_neck_len = + new Path() + .move(points.raglanTipBack) + .curve(points.raglanTipBackCp2, points.raglanTopCp1, points.raglanTop) + .curve(points.raglanTopCp2, points.raglanTipFrontCp1, points.raglanTipFront) + .length() * 2 + + const neck_opening = store.get('front_neck_len') + store.get('back_neck_len') + sleeve_neck_len + const diff = measurements.head - neck_opening + const discrepancy = diff / measurements.head + const warning_limit = 0.04 + let label = ' bigger than ' + if (diff > 0) label = ' smaller than ' + + log.info( + ': ' + + units(neck_opening) + + ' neck opening is ' + + units(Math.abs(diff)) + + label + + ' than ' + + units(measurements.head) + + ' head circumference, with Collar Ease set to ' + + (options.collarEase * 100).toFixed(0) + + '%.' + ) + + if (discrepancy > warning_limit) { + log.warn( + 'Please check and adjust Collar Ease option setting ' + + 'as needed to ensure neck opening is large enough to accommodate ' + + 'head circumference.' + ) + } + return part } diff --git a/sites/orgdocs/docs/designs/hugo/options/collarease/readme.mdx b/sites/orgdocs/docs/designs/hugo/options/collarease/readme.mdx new file mode 100644 index 00000000000..a1470c15e6c --- /dev/null +++ b/sites/orgdocs/docs/designs/hugo/options/collarease/readme.mdx @@ -0,0 +1,12 @@ +--- +title: 'Collar ease' +--- + +![Collar ease](collarease.svg) + +Controls the amount of ease at your collar/neck and the size +of the neck opening.. + +Hugo uses the neck circumference measurement rather than head +circumference to produce the neck opening size when generating patterns. +Use this option to adjust the neck opening size if needed.