1
0
Fork 0
freesewing/designs/sven/src/sleeve.mjs

83 lines
2.2 KiB
JavaScript
Raw Normal View History

2022-09-04 11:24:00 +02:00
import { sleeve as brianSleeve } from '@freesewing/brian'
import { ribbing, front, back } from './frontback.mjs'
2022-09-11 16:59:37 +02:00
function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro, options, part }) {
2019-01-03 15:19:50 +01:00
if (options.ribbing) {
2022-09-04 11:24:00 +02:00
const ribbingHeight = store.get('ribbingHeight')
2019-08-03 15:03:33 +02:00
points.wristLeft = points.wristLeft.shift(90, ribbingHeight)
points.wristRight = points.wristRight.shift(90, ribbingHeight)
points.centerWrist = points.centerWrist.shift(90, ribbingHeight)
2019-01-03 15:19:50 +01:00
}
paths.seam = new Path()
.move(points.wristRight)
.line(points.bicepsRight)
.join(paths.sleevecap)
.line(points.wristLeft)
.line(points.wristRight)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2019-01-03 15:19:50 +01:00
// Complete pattern?
if (complete) {
2019-08-03 15:03:33 +02:00
macro('grainline', {
2019-01-03 15:19:50 +01:00
from: points.centerWrist,
2021-04-24 10:16:31 +02:00
to: points.grainlineTo,
2019-08-03 15:03:33 +02:00
})
2019-01-03 15:19:50 +01:00
if (sa) {
paths.saBase = new Path()
.move(points.wristRight)
.line(points.bicepsRight)
.join(paths.sleevecap)
2019-08-03 15:03:33 +02:00
.line(points.wristLeft)
paths.hemBase = new Path().move(points.wristLeft).line(points.wristRight)
paths.saBase.render = false
paths.hemBase.render = false
paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)))
2021-01-31 09:22:15 +01:00
paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
2019-01-03 15:19:50 +01:00
}
}
// Paperless?
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('vd', {
2019-01-03 15:19:50 +01:00
from: points.wristLeft,
to: points.bicepsLeft,
2021-04-24 10:16:31 +02:00
x: points.bicepsLeft.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-01-03 15:19:50 +01:00
from: points.wristLeft,
to: points.sleeveTip,
2021-04-24 10:16:31 +02:00
x: points.bicepsLeft.x - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-01-03 15:19:50 +01:00
from: points.bicepsLeft,
to: points.bicepsRight,
2021-04-24 10:16:31 +02:00
y: points.sleeveTip.y - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-01-03 15:19:50 +01:00
from: points.wristLeft,
to: points.wristRight,
2021-04-24 10:16:31 +02:00
y: points.wristLeft.y + sa * (options.ribbing ? 1 : 3) + 15,
2019-08-03 15:03:33 +02:00
})
macro('pd', {
2019-01-03 15:19:50 +01:00
path: paths.sleevecap.reverse(),
2021-04-24 10:16:31 +02:00
d: -1 * sa - 15,
2019-08-03 15:03:33 +02:00
})
2019-01-03 15:19:50 +01:00
}
2019-08-03 15:03:33 +02:00
return part
}
2022-09-04 11:24:00 +02:00
export const sleeve = {
name: 'sven.sleeve',
from: brianSleeve,
hideDependencies: true,
2022-09-11 16:59:37 +02:00
after: [front, back],
2022-09-04 11:24:00 +02:00
options: {
ribbing,
cuffEase: { pct: 20, min: 0, max: 200, menu: 'fit' },
},
draft: svenSleeve,
}