1
0
Fork 0

chore(holmes): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 14:31:50 +02:00
parent 0776ccbd0e
commit 1cd21a38b8
4 changed files with 95 additions and 89 deletions

View file

@ -1,7 +1,6 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
function draftHolmesEar (part) { function draftHolmesEar({
let {
Point, Point,
points, points,
Path, Path,
@ -15,8 +14,8 @@ function draftHolmesEar (part) {
paperless, paperless,
macro, macro,
absoluteOptions, absoluteOptions,
} = part.shorthand() part,
}) {
// Design pattern here // Design pattern here
let headCircumference = measurements.head + absoluteOptions.headEase let headCircumference = measurements.head + absoluteOptions.headEase
let earFlapLength = ((options.lengthRatio * headCircumference) / 2) * options.earLength let earFlapLength = ((options.lengthRatio * headCircumference) / 2) * options.earLength
@ -33,8 +32,7 @@ function draftHolmesEar (part) {
.curve(points.bottomC, points.topC, points.top) .curve(points.bottomC, points.topC, points.top)
.curve(points.topCFlipped, points.bottomCFlipped, points.bottomFlipped) .curve(points.topCFlipped, points.bottomCFlipped, points.bottomFlipped)
.setRender(false) .setRender(false)
paths.hemBase = new Path().move(points.bottomFlipped).line(points.bottom) paths.hemBase = new Path().move(points.bottomFlipped).line(points.bottom).setRender(false)
.setRender(false)
paths.seam = paths.saBase.join(paths.hemBase).close() paths.seam = paths.saBase.join(paths.hemBase).close()
// Complete? // Complete?
if (complete) { if (complete) {
@ -85,13 +83,17 @@ export const ear = {
name: 'holmes.ear', name: 'holmes.ear',
measurements: ['head'], measurements: ['head'],
options: { options: {
headEase: { pct: 3, min: 0, max: 9, headEase: {
pct: 3,
min: 0,
max: 9,
snap: { snap: {
metric: [6, 13, 19, 25, 32, 38, 44, 50], metric: [6, 13, 19, 25, 32, 38, 44, 50],
imperial: [6.35, 12.7, 19.05, 25.4, 31.75, 38.1, 44.45, 50.8], imperial: [6.35, 12.7, 19.05, 25.4, 31.75, 38.1, 44.45, 50.8],
}, },
toAbs: (pct, { measurements }) => measurements.head * pct, toAbs: (pct, { measurements }) => measurements.head * pct,
menu: 'fit' }, menu: 'fit',
},
lengthRatio: { pct: 55, min: 40, max: 60, menu: 'style' }, lengthRatio: { pct: 55, min: 40, max: 60, menu: 'style' },
earLength: { pct: 100, min: 80, max: 150, menu: 'style' }, earLength: { pct: 100, min: 80, max: 150, menu: 'style' },
earWidth: { pct: 100, min: 80, max: 150, menu: 'style' }, earWidth: { pct: 100, min: 80, max: 150, menu: 'style' },

View file

@ -1,8 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { pluginGore } from '@freesewing/plugin-gore' import { pluginGore } from '@freesewing/plugin-gore'
function draftHolmesGore (part) { function draftHolmesGore({
let {
Point, Point,
points, points,
Path, Path,
@ -14,10 +13,8 @@ function draftHolmesGore (part) {
sa, sa,
paperless, paperless,
absoluteOptions, absoluteOptions,
} = part.shorthand() part,
}) {
// Design pattern here
//Radius of the head //Radius of the head
let headCircumference = measurements.head + absoluteOptions.headEase let headCircumference = measurements.head + absoluteOptions.headEase
let headRadius = headCircumference / 2 / Math.PI let headRadius = headCircumference / 2 / Math.PI
@ -89,13 +86,17 @@ export const gore = {
name: 'holmes.gore', name: 'holmes.gore',
measurements: ['head'], measurements: ['head'],
options: { options: {
headEase: { pct: 3, min: 0, max: 9, headEase: {
pct: 3,
min: 0,
max: 9,
snap: { snap: {
metric: [6, 13, 19, 25, 32, 38, 44, 50], metric: [6, 13, 19, 25, 32, 38, 44, 50],
imperial: [6.35, 12.7, 19.05, 25.4, 31.75, 38.1, 44.45, 50.8], imperial: [6.35, 12.7, 19.05, 25.4, 31.75, 38.1, 44.45, 50.8],
}, },
toAbs: (pct, { measurements }) => measurements.head * pct, toAbs: (pct, { measurements }) => measurements.head * pct,
menu: 'fit' }, menu: 'fit',
},
lengthRatio: { pct: 55, min: 40, max: 60, menu: 'style' }, lengthRatio: { pct: 55, min: 40, max: 60, menu: 'style' },
gores: { count: 6, min: 4, max: 20, menu: 'style' }, gores: { count: 6, min: 4, max: 20, menu: 'style' },
}, },

View file

@ -1,8 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { pctBasedOn } from '@freesewing/core' import { pctBasedOn } from '@freesewing/core'
function draftHolmesVisor (part) { function draftHolmesVisor({
let {
Point, Point,
points, points,
Path, Path,
@ -14,8 +13,8 @@ function draftHolmesVisor (part) {
paperless, paperless,
macro, macro,
absoluteOptions, absoluteOptions,
} = part.shorthand() part,
}) {
let headCircumference = measurements.head + absoluteOptions.headEase let headCircumference = measurements.head + absoluteOptions.headEase
let headRadius = headCircumference / 2 / Math.PI let headRadius = headCircumference / 2 / Math.PI
let visorRadius = headRadius / Math.sin((options.visorAngle * Math.PI) / 180) let visorRadius = headRadius / Math.sin((options.visorAngle * Math.PI) / 180)
@ -71,7 +70,8 @@ paths.seam = paths.saOuter.join(paths.saInner).close()
if (sa) { if (sa) {
points.sa1 = new Point(points.in2.x + sa, paths.saInner.offset(sa * 2).start().y) points.sa1 = new Point(points.in2.x + sa, paths.saInner.offset(sa * 2).start().y)
points.sa2 = points.sa1.flipX(points.in1) points.sa2 = points.sa1.flipX(points.in1)
paths.sa = paths.saOuter.offset(sa) paths.sa = paths.saOuter
.offset(sa)
.line(points.sa1) .line(points.sa1)
.join(paths.saInner.offset(sa * 2)) .join(paths.saInner.offset(sa * 2))
.line(points.sa2) .line(points.sa2)
@ -105,16 +105,19 @@ export const visor = {
name: 'holmes.visor', name: 'holmes.visor',
measurements: ['head'], measurements: ['head'],
options: { options: {
headEase: { pct: 3, min: 0, max: 9, headEase: {
pct: 3,
min: 0,
max: 9,
snap: { snap: {
metric: [6, 13, 19, 25, 32, 38, 44, 50], metric: [6, 13, 19, 25, 32, 38, 44, 50],
imperial: [6.35, 12.7, 19.05, 25.4, 31.75, 38.1, 44.45, 50.8], imperial: [6.35, 12.7, 19.05, 25.4, 31.75, 38.1, 44.45, 50.8],
}, },
toAbs: (pct, { measurements }) => measurements.head * pct, toAbs: (pct, { measurements }) => measurements.head * pct,
menu: 'fit' }, menu: 'fit',
},
visorAngle: { deg: 45, min: 10, max: 90, menu: 'style' }, visorAngle: { deg: 45, min: 10, max: 90, menu: 'style' },
visorWidth: { pct: 5, min: 1, max: 17, snap: 5, ...pctBasedOn('head'), visorWidth: { pct: 5, min: 1, max: 17, snap: 5, ...pctBasedOn('head'), menu: 'style' },
menu: 'style' },
visorLength: { pct: 100, min: 80, max: 150, menu: 'advanced' }, visorLength: { pct: 100, min: 80, max: 150, menu: 'advanced' },
}, },
plugins: [pluginBundle], plugins: [pluginBundle],