1
0
Fork 0

chore(sven): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 16:59:37 +02:00
parent 19cf0d46eb
commit e24f9c393b
5 changed files with 28 additions and 29 deletions

View file

@ -2,12 +2,12 @@ import { draftRibbing } from './shared.mjs'
import { ribbing } from './frontback.mjs' import { ribbing } from './frontback.mjs'
import { sleeve } from './sleeve.mjs' import { sleeve } from './sleeve.mjs'
function svenCuff(part) { function svenCuff(params) {
const { measurements, sa, points, complete, paperless, macro, options } = part.shorthand() const { measurements, sa, points, complete, paperless, macro, options, part } = params
if (!options.ribbing) return part if (!options.ribbing) return part
const length = measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch) const length = measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch)
draftRibbing(part, length) draftRibbing(params, length)
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {

View file

@ -1,19 +1,19 @@
import { front as brianFront, back as brianBack } from '@freesewing/brian' import { front as brianFront, back as brianBack } from '@freesewing/brian'
function svenFrontBack(part) { function svenFrontBack({
const { store,
store, measurements,
measurements, sa,
sa, Point,
Point, points,
points, Path,
Path, paths,
paths, complete,
complete, paperless,
paperless, macro,
macro, options,
options, part,
} = part.shorthand() }) {
let front = true let front = true
if (typeof points.cfHem === 'undefined') front = false if (typeof points.cfHem === 'undefined') front = false

View file

@ -1,5 +1,5 @@
export const draftRibbing = function (part, length) { export const draftRibbing = function (
const { {
store, store,
measurements, measurements,
options, options,
@ -12,8 +12,10 @@ export const draftRibbing = function (part, length) {
paperless, paperless,
macro, macro,
units, units,
} = part.shorthand() part,
},
length
) {
let height = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight let height = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight
if (part.context.settings.sample) store.set('ribbingHeight', height) if (part.context.settings.sample) store.set('ribbingHeight', height)
else store.setIfUnset('ribbingHeight', height) else store.setIfUnset('ribbingHeight', height)

View file

@ -1,9 +1,7 @@
import { sleeve as brianSleeve } from '@freesewing/brian' import { sleeve as brianSleeve } from '@freesewing/brian'
import { ribbing, front, back } from './frontback.mjs' import { ribbing, front, back } from './frontback.mjs'
function svenSleeve(part) { function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro, options, part }) {
const { store, sa, points, paths, Path, complete, paperless, macro, options } = part.shorthand()
if (options.ribbing) { if (options.ribbing) {
const ribbingHeight = store.get('ribbingHeight') const ribbingHeight = store.get('ribbingHeight')
points.wristLeft = points.wristLeft.shift(90, ribbingHeight) points.wristLeft = points.wristLeft.shift(90, ribbingHeight)
@ -11,7 +9,6 @@ function svenSleeve(part) {
points.centerWrist = points.centerWrist.shift(90, ribbingHeight) points.centerWrist = points.centerWrist.shift(90, ribbingHeight)
} }
paths.seam = new Path() paths.seam = new Path()
.move(points.wristRight) .move(points.wristRight)
.line(points.bicepsRight) .line(points.bicepsRight)
@ -76,7 +73,7 @@ export const sleeve = {
name: 'sven.sleeve', name: 'sven.sleeve',
from: brianSleeve, from: brianSleeve,
hideDependencies: true, hideDependencies: true,
after: [ front, back ], after: [front, back],
options: { options: {
ribbing, ribbing,
cuffEase: { pct: 20, min: 0, max: 200, menu: 'fit' }, cuffEase: { pct: 20, min: 0, max: 200, menu: 'fit' },

View file

@ -2,13 +2,13 @@ import { draftRibbing } from './shared.mjs'
import { ribbing, hipsEase } from './frontback.mjs' import { ribbing, hipsEase } from './frontback.mjs'
import { ribbingStretch } from './cuff.mjs' import { ribbingStretch } from './cuff.mjs'
function svenWaistband(part) { function svenWaistband(params) {
const { measurements, sa, points, complete, paperless, macro, options } = part.shorthand() const { measurements, sa, points, complete, paperless, macro, options, part } = params
if (!options.ribbing) return part if (!options.ribbing) return part
let length = measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch) let length = measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch)
draftRibbing(part, length) draftRibbing(params, length)
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {