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 { sleeve } from './sleeve.mjs'
function svenCuff(part) {
const { measurements, sa, points, complete, paperless, macro, options } = part.shorthand()
function svenCuff(params) {
const { measurements, sa, points, complete, paperless, macro, options, part } = params
if (!options.ribbing) return part
const length = measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch)
draftRibbing(part, length)
draftRibbing(params, length)
// Complete pattern?
if (complete) {

View file

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

View file

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

View file

@ -1,9 +1,7 @@
import { sleeve as brianSleeve } from '@freesewing/brian'
import { ribbing, front, back } from './frontback.mjs'
function svenSleeve(part) {
const { store, sa, points, paths, Path, complete, paperless, macro, options } = part.shorthand()
function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro, options, part }) {
if (options.ribbing) {
const ribbingHeight = store.get('ribbingHeight')
points.wristLeft = points.wristLeft.shift(90, ribbingHeight)
@ -11,7 +9,6 @@ function svenSleeve(part) {
points.centerWrist = points.centerWrist.shift(90, ribbingHeight)
}
paths.seam = new Path()
.move(points.wristRight)
.line(points.bicepsRight)
@ -76,7 +73,7 @@ export const sleeve = {
name: 'sven.sleeve',
from: brianSleeve,
hideDependencies: true,
after: [ front, back ],
after: [front, back],
options: {
ribbing,
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 { ribbingStretch } from './cuff.mjs'
function svenWaistband(part) {
const { measurements, sa, points, complete, paperless, macro, options } = part.shorthand()
function svenWaistband(params) {
const { measurements, sa, points, complete, paperless, macro, options, part } = params
if (!options.ribbing) return part
let length = measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch)
draftRibbing(part, length)
draftRibbing(params, length)
// Complete pattern?
if (complete) {