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) {
let { measurements, options, store, points, paths, Point, Path } = part.shorthand()
function draftCathrinBase({ measurements, options, store, points, paths, Point, Path, part }) {
// Where to divide our corset into panels
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])
@ -94,9 +92,7 @@ function draftCathrinBase (part) {
export const base = {
name: 'cathrin.base',
hide: true,
measurements: [
'underbust', 'waist', 'hips', 'waistToUnderbust', 'waistToHips',
],
measurements: ['underbust', 'waist', 'hips', 'waistToUnderbust', 'waistToHips'],
options: {
waistReduction: { pct: 10, min: 2, max: 20, menu: 'fit' },
panels: { list: ['11', '13'], dflt: '13', menu: 'fit' },

View file

@ -14,13 +14,8 @@ import { panels } from './panels.mjs'
// Create design
const Cathrin = new Design({
data,
parts: [
panel1, panel2, panel3, panel4, panel5, panel6,
],
parts: [panel1, panel2, panel3, panel4, panel5, panel6],
})
// Named exports
export {
base, panels, panel1, panel2, panel3, panel4, panel5, panel6,
Cathrin,
}
export { 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 { draftPanel1ab } from './panel1ab.mjs'
function draftCathrinPanel1 (part) {
let { macro, sa, paths, points, options, complete, paperless } = part.shorthand()
function draftCathrinPanel1(params) {
const { macro, sa, paths, points, options, complete, paperless, part } = params
points.anchor = points.topCF.clone()
@ -14,7 +14,7 @@ function draftCathrinPanel1 (part) {
delete paths.panel5
delete paths.panel6
if (options.panels === '13') return draftPanel1ab(part)
if (options.panels === '13') return draftPanel1ab(params)
// Complete pattern?
if (complete) {
@ -76,6 +76,6 @@ function draftCathrinPanel1 (part) {
export const panel1 = {
name: 'cathrin.panel1',
from: panels,
plugins: [ pluginBundle ],
plugins: [pluginBundle],
draft: draftCathrinPanel1,
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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