chore(trayvon): Port to v3 stage 2
This commit is contained in:
parent
809875ffac
commit
8a7d893c12
5 changed files with 59 additions and 55 deletions
|
@ -7,12 +7,11 @@ import {
|
|||
options,
|
||||
} from './shared.mjs'
|
||||
|
||||
function trayvonFabricTail(part) {
|
||||
const { Path, complete, macro, paths, points, paperless, sa, store, absoluteOptions } =
|
||||
part.shorthand()
|
||||
function trayvonFabricTail(params) {
|
||||
const { Path, complete, macro, paths, points, paperless, sa, store, absoluteOptions } = params
|
||||
|
||||
calculateHelpers(part)
|
||||
draftTieShape(part, store.get('backTip') * 2.5, absoluteOptions.knotWidth * 2.5, true)
|
||||
calculateHelpers(params)
|
||||
draftTieShape(params, store.get('backTip') * 2.5, absoluteOptions.knotWidth * 2.5, true)
|
||||
paths.seam.attributes.add('class', 'fabric')
|
||||
|
||||
// Complete pattern?
|
||||
|
@ -29,7 +28,7 @@ function trayvonFabricTail(part) {
|
|||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
tieShapeDimensions(part)
|
||||
tieShapeDimensions(params)
|
||||
macro('ld', {
|
||||
from: points.tip,
|
||||
to: points.notch1,
|
||||
|
@ -48,10 +47,10 @@ function trayvonFabricTail(part) {
|
|||
.attr('data-text-class', 'center')
|
||||
}
|
||||
|
||||
return part
|
||||
return params.part
|
||||
}
|
||||
|
||||
function trayvonFabricTip(part) {
|
||||
function trayvonFabricTip(params) {
|
||||
const {
|
||||
Path,
|
||||
Snippet,
|
||||
|
@ -63,10 +62,10 @@ function trayvonFabricTip(part) {
|
|||
sa,
|
||||
snippets,
|
||||
absoluteOptions,
|
||||
} = part.shorthand()
|
||||
} = params
|
||||
|
||||
calculateHelpers(part)
|
||||
draftTieShape(part, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5, true)
|
||||
calculateHelpers(params)
|
||||
draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5, true)
|
||||
paths.seam.attributes.add('class', 'fabric')
|
||||
|
||||
// Complete pattern?
|
||||
|
@ -105,14 +104,14 @@ function trayvonFabricTip(part) {
|
|||
.attr('data-text-class', 'center')
|
||||
}
|
||||
|
||||
return part
|
||||
return params.part
|
||||
}
|
||||
|
||||
export const fabricTail = {
|
||||
name: 'trayvon.fabricTail',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
options,
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonFabricTail,
|
||||
}
|
||||
|
||||
|
@ -120,6 +119,6 @@ export const fabricTip = {
|
|||
name: 'trayvon.fabricTip',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
options,
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonFabricTip,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||
import { draftTieShape, tieShapeDimensions, calculateHelpers, options } from './shared.mjs'
|
||||
|
||||
function trayvonInterfacingTail(part) {
|
||||
const { paths, points, macro, complete, paperless, Path, store, absoluteOptions } =
|
||||
part.shorthand()
|
||||
function trayvonInterfacingTail(params) {
|
||||
const { paths, points, macro, complete, paperless, Path, store, absoluteOptions } = params
|
||||
|
||||
calculateHelpers(part)
|
||||
draftTieShape(part, store.get('backTip'), absoluteOptions.knotWidth)
|
||||
calculateHelpers(params)
|
||||
draftTieShape(params, store.get('backTip'), absoluteOptions.knotWidth)
|
||||
paths.seam.attributes.add('class', 'interfacing')
|
||||
|
||||
// Complete pattern?
|
||||
|
@ -21,7 +20,7 @@ function trayvonInterfacingTail(part) {
|
|||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
tieShapeDimensions(part)
|
||||
tieShapeDimensions(params)
|
||||
paths.n45 = new Path()
|
||||
.move(points.midLeft)
|
||||
.line(points.midRight)
|
||||
|
@ -30,14 +29,14 @@ function trayvonInterfacingTail(part) {
|
|||
.attr('data-text-class', 'center')
|
||||
}
|
||||
|
||||
return part
|
||||
return params.part
|
||||
}
|
||||
|
||||
function trayvonInterfacingTip(part) {
|
||||
let { paths, points, macro, complete, paperless, Path, absoluteOptions } = part.shorthand()
|
||||
function trayvonInterfacingTip(params) {
|
||||
const { paths, points, macro, complete, paperless, Path, absoluteOptions } = params
|
||||
|
||||
calculateHelpers(part)
|
||||
draftTieShape(part, absoluteOptions.tipWidth, absoluteOptions.knotWidth)
|
||||
calculateHelpers(params)
|
||||
draftTieShape(params, absoluteOptions.tipWidth, absoluteOptions.knotWidth)
|
||||
paths.seam.attributes.add('class', 'interfacing')
|
||||
|
||||
// Complete pattern?
|
||||
|
@ -61,20 +60,20 @@ function trayvonInterfacingTip(part) {
|
|||
.attr('data-text-class', 'center')
|
||||
}
|
||||
|
||||
return part
|
||||
return params.part
|
||||
}
|
||||
|
||||
export const interfacingTail = {
|
||||
name: 'trayvon.interfacingTail',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
options,
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonInterfacingTail,
|
||||
}
|
||||
export const interfacingTip = {
|
||||
name: 'trayvon.interfacingTip',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
options,
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonInterfacingTip,
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
options,
|
||||
} from './shared.mjs'
|
||||
|
||||
function trayvonLiningTail(part) {
|
||||
function trayvonLiningTail(params) {
|
||||
const {
|
||||
Path,
|
||||
Snippet,
|
||||
|
@ -21,10 +21,10 @@ function trayvonLiningTail(part) {
|
|||
snippets,
|
||||
store,
|
||||
absoluteOptions,
|
||||
} = part.shorthand()
|
||||
} = params
|
||||
|
||||
calculateHelpers(part)
|
||||
draftTieShape(part, store.get('backTip') * 2.5, options.knotWidth * 2.5)
|
||||
calculateHelpers(params)
|
||||
draftTieShape(params, store.get('backTip') * 2.5, options.knotWidth * 2.5)
|
||||
|
||||
// Cut part short
|
||||
points.cutRight = points.tipRight.shiftTowards(points.midRight, absoluteOptions.tipWidth * 2.5)
|
||||
|
@ -57,10 +57,10 @@ function trayvonLiningTail(part) {
|
|||
// Paperless?
|
||||
if (paperless) tieShapeDimensions(part, true)
|
||||
|
||||
return part
|
||||
return params.part
|
||||
}
|
||||
|
||||
function trayvonLiningTip(part) {
|
||||
function trayvonLiningTip(params) {
|
||||
const {
|
||||
Path,
|
||||
Snippet,
|
||||
|
@ -72,10 +72,10 @@ function trayvonLiningTip(part) {
|
|||
sa,
|
||||
snippets,
|
||||
absoluteOptions,
|
||||
} = part.shorthand()
|
||||
} = params
|
||||
|
||||
calculateHelpers(part)
|
||||
draftTieShape(part, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5)
|
||||
calculateHelpers(params)
|
||||
draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5)
|
||||
|
||||
// Cut part short
|
||||
points.cutRight = points.tipRight.shiftTowards(points.midRight, absoluteOptions.tipWidth * 2.5)
|
||||
|
@ -111,14 +111,14 @@ function trayvonLiningTip(part) {
|
|||
tieShapeDimensions(part, true)
|
||||
}
|
||||
|
||||
return part
|
||||
return params.part
|
||||
}
|
||||
|
||||
export const liningTail = {
|
||||
name: 'trayvon.liningTail',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
options,
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonLiningTail,
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,6 @@ export const liningTip = {
|
|||
name: 'trayvon.liningTip',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
options,
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonLiningTip,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||
|
||||
function trayvonFabricLoop(part) {
|
||||
const { points, Point, paths, Path, complete, paperless, store, macro } = part.shorthand()
|
||||
|
||||
function trayvonFabricLoop({
|
||||
points,
|
||||
Point,
|
||||
paths,
|
||||
Path,
|
||||
complete,
|
||||
paperless,
|
||||
store,
|
||||
macro,
|
||||
part,
|
||||
}) {
|
||||
points.topLeft = new Point(0, 0)
|
||||
points.bottomRight = new Point(store.get('backTip') * 3.5, store.get('backTip'))
|
||||
points.topRight = new Point(points.bottomRight.x, points.topLeft.y)
|
||||
|
@ -46,6 +54,6 @@ function trayvonFabricLoop(part) {
|
|||
export const fabricLoop = {
|
||||
name: 'trayvon.fabricLoop',
|
||||
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
|
||||
plugins: [ pluginBundle ],
|
||||
plugins: [pluginBundle],
|
||||
draft: trayvonFabricLoop,
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ export const options = {
|
|||
menu: 'style',
|
||||
},
|
||||
}
|
||||
export const calculateHelpers = (part) => {
|
||||
let { store, measurements, options, absoluteOptions } = part.shorthand()
|
||||
|
||||
export const calculateHelpers = ({ store, measurements, options, absoluteOptions }) => {
|
||||
let halfLength =
|
||||
(measurements.hpsToWaistBack + measurements.waistToHips + measurements.neck / 2) *
|
||||
(1 + options.lengthBonus)
|
||||
|
@ -24,9 +22,12 @@ export const calculateHelpers = (part) => {
|
|||
store.set('backTip', backTip)
|
||||
}
|
||||
|
||||
export const draftTieShape = (part, tipWidth, knotWidth, notch = false) => {
|
||||
let { points, Point, store, utils, paths, Path, macro, absoluteOptions } = part.shorthand()
|
||||
|
||||
export const draftTieShape = (
|
||||
{ points, Point, store, utils, paths, Path, macro, absoluteOptions },
|
||||
tipWidth,
|
||||
knotWidth,
|
||||
notch = false
|
||||
) => {
|
||||
let hl = store.get('halfLength')
|
||||
let ht = tipWidth / 2
|
||||
let hk = knotWidth / 2
|
||||
|
@ -62,9 +63,7 @@ export const draftTieShape = (part, tipWidth, knotWidth, notch = false) => {
|
|||
.close()
|
||||
}
|
||||
|
||||
export const tieShapeDimensions = (part, lining = false) => {
|
||||
let { points, macro, paths, Path } = part.shorthand()
|
||||
|
||||
export const tieShapeDimensions = ({ points, macro, paths, Path }, lining = false) => {
|
||||
macro('hd', {
|
||||
from: points.tipLeft,
|
||||
to: points.tipRight,
|
||||
|
@ -100,8 +99,7 @@ export const tieShapeDimensions = (part, lining = false) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const seamAllowance = (part, className) => {
|
||||
let { paths, Path, points, sa } = part.shorthand()
|
||||
export const seamAllowance = ({ paths, Path, points, sa }, className) => {
|
||||
paths.sa = new Path()
|
||||
.move(points.tipLeft)
|
||||
.line(points.tip)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue