chore(sandy): Port to v3 stage 2
This commit is contained in:
parent
750afa139c
commit
42b8207079
4 changed files with 59 additions and 56 deletions
|
@ -1,26 +1,26 @@
|
||||||
import { draftRingSector } from './shared.mjs'
|
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
|
* The curved waistband is just a ring sector with external
|
||||||
* and intenal radius and angle calculated from measurements
|
* and intenal radius and angle calculated from measurements
|
||||||
* and options
|
* 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
|
// Calculate the angle of the ring sector and the radius of the upper arc
|
||||||
const an =
|
const an =
|
||||||
|
|
|
@ -3,24 +3,23 @@ import { pctBasedOn } from '@freesewing/core'
|
||||||
import { pluginBundle } from '@freesewing/plugin-bundle'
|
import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||||
import { elastics } from '@freesewing/snapseries'
|
import { elastics } from '@freesewing/snapseries'
|
||||||
|
|
||||||
function sandySkirt(part) {
|
function sandySkirt({
|
||||||
const {
|
utils,
|
||||||
utils,
|
store,
|
||||||
store,
|
sa,
|
||||||
sa,
|
points,
|
||||||
points,
|
Path,
|
||||||
Path,
|
paths,
|
||||||
paths,
|
Snippet,
|
||||||
Snippet,
|
snippets,
|
||||||
snippets,
|
options,
|
||||||
options,
|
measurements,
|
||||||
measurements,
|
complete,
|
||||||
complete,
|
paperless,
|
||||||
paperless,
|
macro,
|
||||||
macro,
|
absoluteOptions,
|
||||||
absoluteOptions,
|
part,
|
||||||
} = part.shorthand()
|
}) {
|
||||||
|
|
||||||
// Circumference of the top of the waistband, calculated from the waistbandPosition option
|
// Circumference of the top of the waistband, calculated from the waistbandPosition option
|
||||||
store.set(
|
store.set(
|
||||||
'topCircumference',
|
'topCircumference',
|
||||||
|
@ -219,8 +218,14 @@ export const skirt = {
|
||||||
options: {
|
options: {
|
||||||
minimumOverlap: 15, // Lower than this and we don't draw a button
|
minimumOverlap: 15, // Lower than this and we don't draw a button
|
||||||
seamlessFullCircle: { bool: false, menu: 'construction' },
|
seamlessFullCircle: { bool: false, menu: 'construction' },
|
||||||
waistbandWidth: { pct: 4, min: 1, max: 8, snap: elastics,
|
waistbandWidth: {
|
||||||
...pctBasedOn('waistToFloor'), menu: 'style' },
|
pct: 4,
|
||||||
|
min: 1,
|
||||||
|
max: 8,
|
||||||
|
snap: elastics,
|
||||||
|
...pctBasedOn('waistToFloor'),
|
||||||
|
menu: 'style',
|
||||||
|
},
|
||||||
waistbandPosition: { pct: 50, min: 0, max: 100, menu: 'fit' },
|
waistbandPosition: { pct: 50, min: 0, max: 100, menu: 'fit' },
|
||||||
lengthBonus: { pct: 50, min: 10, max: 100, menu: 'style' },
|
lengthBonus: { pct: 50, min: 10, max: 100, menu: 'style' },
|
||||||
circleRatio: { pct: 50, min: 20, max: 100, menu: 'style' },
|
circleRatio: { pct: 50, min: 20, max: 100, menu: 'style' },
|
||||||
|
|
|
@ -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
|
* The straight waistband is just a rectangle with the width
|
||||||
* of double the waistband width, since it will be folded
|
* 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
|
// Calculate the corners of the rectangle and other auxiliar points
|
||||||
points.center = new Point(0, 0)
|
points.center = new Point(0, 0)
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import { draftStraightWaistband } from './straight-waistband.mjs'
|
import { draftStraightWaistband } from './straight-waistband.mjs'
|
||||||
import { draftCurvedWaistband } from './curved-waistband.mjs'
|
import { draftCurvedWaistband } from './curved-waistband.mjs'
|
||||||
|
|
||||||
const sandyWaistband = (part) => {
|
const sandyWaistband = (params) => {
|
||||||
const { options } = part.shorthand()
|
if (params.options.waistbandShape === 'curved') return draftCurvedWaistband(params)
|
||||||
|
else return draftStraightWaistband(params)
|
||||||
if (options.waistbandShape === 'curved') return draftCurvedWaistband(part)
|
|
||||||
else return draftStraightWaistband(part)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const waistband = {
|
export const waistband = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue