1
0
Fork 0

chore(sandy): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 16:39:52 +02:00
parent 750afa139c
commit 42b8207079
4 changed files with 59 additions and 56 deletions

View file

@ -1,26 +1,26 @@
import { draftRingSector } from './shared.mjs'
export function draftCurvedWaistband(part) {
export function draftCurvedWaistband({
utils,
store,
sa,
points,
Path,
paths,
Snippet,
snippets,
options,
complete,
paperless,
macro,
absoluteOptions,
part,
}) {
/**
* The curved waistband is just a ring sector with external
* and intenal radius and angle calculated from measurements
* and options
*/
const {
utils,
store,
sa,
points,
Path,
paths,
Snippet,
snippets,
options,
complete,
paperless,
macro,
absoluteOptions,
} = part.shorthand()
// Calculate the angle of the ring sector and the radius of the upper arc
const an =

View file

@ -3,24 +3,23 @@ import { pctBasedOn } from '@freesewing/core'
import { pluginBundle } from '@freesewing/plugin-bundle'
import { elastics } from '@freesewing/snapseries'
function sandySkirt(part) {
const {
utils,
store,
sa,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro,
absoluteOptions,
} = part.shorthand()
function sandySkirt({
utils,
store,
sa,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro,
absoluteOptions,
part,
}) {
// Circumference of the top of the waistband, calculated from the waistbandPosition option
store.set(
'topCircumference',
@ -219,8 +218,14 @@ export const skirt = {
options: {
minimumOverlap: 15, // Lower than this and we don't draw a button
seamlessFullCircle: { bool: false, menu: 'construction' },
waistbandWidth: { pct: 4, min: 1, max: 8, snap: elastics,
...pctBasedOn('waistToFloor'), menu: 'style' },
waistbandWidth: {
pct: 4,
min: 1,
max: 8,
snap: elastics,
...pctBasedOn('waistToFloor'),
menu: 'style',
},
waistbandPosition: { pct: 50, min: 0, max: 100, menu: 'fit' },
lengthBonus: { pct: 50, min: 10, max: 100, menu: 'style' },
circleRatio: { pct: 50, min: 20, max: 100, menu: 'style' },

View file

@ -1,22 +1,22 @@
export function draftStraightWaistband(part) {
export function draftStraightWaistband({
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro,
absoluteOptions,
part,
}) {
/**
* The straight waistband is just a rectangle with the width
* of double the waistband width, since it will be folded
*/
const {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro,
absoluteOptions,
} = part.shorthand()
// Calculate the corners of the rectangle and other auxiliar points
points.center = new Point(0, 0)

View file

@ -1,11 +1,9 @@
import { draftStraightWaistband } from './straight-waistband.mjs'
import { draftCurvedWaistband } from './curved-waistband.mjs'
const sandyWaistband = (part) => {
const { options } = part.shorthand()
if (options.waistbandShape === 'curved') return draftCurvedWaistband(part)
else return draftStraightWaistband(part)
const sandyWaistband = (params) => {
if (params.options.waistbandShape === 'curved') return draftCurvedWaistband(params)
else return draftStraightWaistband(params)
}
export const waistband = {