1
0
Fork 0

chore(cathrin): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 13:00:57 +02:00
parent d130fd62a9
commit f064b25c12
10 changed files with 44 additions and 50 deletions

View file

@ -1,6 +1,4 @@
function draftCathrinBase (part) { function draftCathrinBase({ measurements, options, store, points, paths, Point, Path, part }) {
let { measurements, options, store, points, paths, Point, Path } = part.shorthand()
// Where to divide our corset into panels // Where to divide our corset into panels
if (options.panels === '11') store.set('gaps', [0.15, 0.275, 0.4, 0.6, 0.75]) if (options.panels === '11') store.set('gaps', [0.15, 0.275, 0.4, 0.6, 0.75])
else store.set('gaps', [0.2, 0.35, 0.5, 0.65, 0.8]) else store.set('gaps', [0.2, 0.35, 0.5, 0.65, 0.8])
@ -94,9 +92,7 @@ function draftCathrinBase (part) {
export const base = { export const base = {
name: 'cathrin.base', name: 'cathrin.base',
hide: true, hide: true,
measurements: [ measurements: ['underbust', 'waist', 'hips', 'waistToUnderbust', 'waistToHips'],
'underbust', 'waist', 'hips', 'waistToUnderbust', 'waistToHips',
],
options: { options: {
waistReduction: { pct: 10, min: 2, max: 20, menu: 'fit' }, waistReduction: { pct: 10, min: 2, max: 20, menu: 'fit' },
panels: { list: ['11', '13'], dflt: '13', menu: 'fit' }, panels: { list: ['11', '13'], dflt: '13', menu: 'fit' },

View file

@ -14,13 +14,8 @@ import { panels } from './panels.mjs'
// Create design // Create design
const Cathrin = new Design({ const Cathrin = new Design({
data, data,
parts: [ parts: [panel1, panel2, panel3, panel4, panel5, panel6],
panel1, panel2, panel3, panel4, panel5, panel6,
],
}) })
// Named exports // Named exports
export { export { base, panels, panel1, panel2, panel3, panel4, panel5, panel6, Cathrin }
base, panels, panel1, panel2, panel3, panel4, panel5, panel6,
Cathrin,
}

View file

@ -2,8 +2,8 @@ import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs' import { panels } from './panels.mjs'
import { draftPanel1ab } from './panel1ab.mjs' import { draftPanel1ab } from './panel1ab.mjs'
function draftCathrinPanel1 (part) { function draftCathrinPanel1(params) {
let { macro, sa, paths, points, options, complete, paperless } = part.shorthand() const { macro, sa, paths, points, options, complete, paperless, part } = params
points.anchor = points.topCF.clone() points.anchor = points.topCF.clone()
@ -14,7 +14,7 @@ function draftCathrinPanel1 (part) {
delete paths.panel5 delete paths.panel5
delete paths.panel6 delete paths.panel6
if (options.panels === '13') return draftPanel1ab(part) if (options.panels === '13') return draftPanel1ab(params)
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {
@ -76,6 +76,6 @@ function draftCathrinPanel1 (part) {
export const panel1 = { export const panel1 = {
name: 'cathrin.panel1', name: 'cathrin.panel1',
from: panels, from: panels,
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftCathrinPanel1, draft: draftCathrinPanel1,
} }

View file

@ -1,6 +1,15 @@
export function draftPanel1ab (part) { export function draftPanel1ab({
let { macro, utils, sa, points, paths, Point, Path, complete, paperless } = part.shorthand() macro,
utils,
sa,
points,
paths,
Point,
Path,
complete,
paperless,
part,
}) {
points.anchor = points.topCF.clone() points.anchor = points.topCF.clone()
let top = new Path() let top = new Path()
@ -18,10 +27,7 @@ export function draftPanel1ab (part) {
.line(points.topABsplit) .line(points.topABsplit)
.join(top.split(points.topABsplit)[1]) .join(top.split(points.topABsplit)[1])
.setRender(false) .setRender(false)
paths.panel1a = paths.panel1a_nonfold.clone() paths.panel1a = paths.panel1a_nonfold.clone().close().attr('class', 'fabric').setRender(true)
.close()
.attr('class', 'fabric')
.setRender(true)
paths.panel1b = bottom paths.panel1b = bottom
.split(points.bottomABsplit)[1] .split(points.bottomABsplit)[1]
.curve(points.hipsGap1Cp, points.waistGap1LeftCp1, points.waistGap1Left) .curve(points.hipsGap1Cp, points.waistGap1LeftCp1, points.waistGap1Left)
@ -39,10 +45,7 @@ export function draftPanel1ab (part) {
if (complete) { if (complete) {
if (sa) { if (sa) {
paths.saA = paths.panel1a_nonfold.offset(sa).attr('class', 'fabric sa') paths.saA = paths.panel1a_nonfold.offset(sa).attr('class', 'fabric sa')
paths.saA paths.saA.line(points.topCF).move(points.bottomCF).line(paths.saA.start())
.line(points.topCF)
.move(points.bottomCF)
.line(paths.saA.start())
paths.saB = paths.panel1b.offset(sa).attr('class', 'fabric sa') paths.saB = paths.panel1b.offset(sa).attr('class', 'fabric sa')
} }
macro('cutonfold', { macro('cutonfold', {

View file

@ -1,9 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs' import { panels } from './panels.mjs'
function draftCathrinPanel2 (part) { function draftCathrinPanel2({ macro, sa, points, paths, Point, complete, paperless, part }) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap1Right.clone() points.anchor = points.underbustGap1Right.clone()
delete paths.outline delete paths.outline
@ -77,6 +75,6 @@ function draftCathrinPanel2 (part) {
export const panel2 = { export const panel2 = {
name: 'cathrin.panel2', name: 'cathrin.panel2',
from: panels, from: panels,
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftCathrinPanel2, draft: draftCathrinPanel2,
} }

View file

@ -1,9 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs' import { panels } from './panels.mjs'
function draftCathrinPanel3 (part) { function draftCathrinPanel3({ macro, sa, points, paths, Point, complete, paperless, part }) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap2Right.clone() points.anchor = points.underbustGap2Right.clone()
delete paths.outline delete paths.outline
@ -77,6 +75,6 @@ function draftCathrinPanel3 (part) {
export const panel3 = { export const panel3 = {
name: 'cathrin.panel3', name: 'cathrin.panel3',
from: panels, from: panels,
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftCathrinPanel3, draft: draftCathrinPanel3,
} }

View file

@ -1,9 +1,18 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs' import { panels } from './panels.mjs'
function draftCathrinPanel4 (part) { function draftCathrinPanel4({
let { macro, sa, snippets, Snippet, points, paths, Point, complete, paperless } = part.shorthand() macro,
sa,
snippets,
Snippet,
points,
paths,
Point,
complete,
paperless,
part,
}) {
points.anchor = points.underbustGap3Right.clone() points.anchor = points.underbustGap3Right.clone()
delete paths.outline delete paths.outline
@ -80,6 +89,6 @@ function draftCathrinPanel4 (part) {
export const panel4 = { export const panel4 = {
name: 'cathrin.panel4', name: 'cathrin.panel4',
from: panels, from: panels,
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftCathrinPanel4, draft: draftCathrinPanel4,
} }

View file

@ -1,9 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs' import { panels } from './panels.mjs'
function draftCathrinPanel5 (part) { function draftCathrinPanel5({ macro, sa, points, paths, Point, complete, paperless, part }) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.underbustGap4Right.clone() points.anchor = points.underbustGap4Right.clone()
delete paths.outline delete paths.outline
@ -77,6 +75,6 @@ function draftCathrinPanel5 (part) {
export const panel5 = { export const panel5 = {
name: 'cathrin.panel5', name: 'cathrin.panel5',
from: panels, from: panels,
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftCathrinPanel5, draft: draftCathrinPanel5,
} }

View file

@ -1,9 +1,7 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import { panels } from './panels.mjs' import { panels } from './panels.mjs'
function draftCathrinPanel6 (part) { function draftCathrinPanel6({ macro, sa, points, paths, Point, complete, paperless, part }) {
let { macro, sa, points, paths, Point, complete, paperless } = part.shorthand()
points.anchor = points.backRise.clone() points.anchor = points.backRise.clone()
delete paths.outline delete paths.outline
@ -82,6 +80,6 @@ function draftCathrinPanel6 (part) {
export const panel6 = { export const panel6 = {
name: 'cathrin.panel6', name: 'cathrin.panel6',
from: panels, from: panels,
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftCathrinPanel6, draft: draftCathrinPanel6,
} }

View file

@ -1,7 +1,6 @@
import { base } from './base.mjs' import { base } from './base.mjs'
function draftCathrinPanels (part) { function draftCathrinPanels({ measurements, options, store, points, paths, Point, Path, part }) {
let { measurements, options, store, points, paths, Point, Path } = part.shorthand()
let count = 1 let count = 1
let bottom = new Path() let bottom = new Path()
.move(points.bottomCF) .move(points.bottomCF)