1
0
Fork 0
freesewing/designs/huey/src/pocket.mjs

89 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-09-05 19:05:02 -07:00
import { front } from './front.mjs'
2022-09-11 14:36:26 +02:00
function draftHueyPocket({
macro,
Path,
points,
paths,
complete,
paperless,
snippets,
Snippet,
sa,
options,
part,
}) {
2019-08-03 15:03:33 +02:00
if (!options.pocket) return part
2019-03-03 16:04:24 +01:00
// Clear paths and snippets
2019-08-03 15:03:33 +02:00
for (let p of Object.keys(paths)) delete paths[p]
for (let p of Object.keys(snippets)) delete snippets[p]
2019-03-03 16:04:24 +01:00
// Paths
paths.seam = new Path()
.move(points.cfHem)
.line(points.pocketHem)
.line(points.pocketTip)
.curve_(points.pocketTipCp2, points.pocketTopRight)
.line(points.pocketCfTop)
.line(points.cfHem)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2019-03-03 16:04:24 +01:00
// Complete?
if (complete) {
2019-08-03 15:03:33 +02:00
points.logo = points.pocketCfTop.shiftFractionTowards(points.pocketHem, 0.3)
points.title = points.pocketCfTop.shiftFractionTowards(points.pocketHem, 0.5)
snippets.logo = new Snippet('logo', points.logo)
macro('title', {
2019-03-03 16:04:24 +01:00
at: points.title,
nr: 4,
2021-04-24 10:16:31 +02:00
title: 'pocket',
2019-08-03 15:03:33 +02:00
})
macro('grainline', {
from: points.pocketCfTop.shift(-45, 10),
to: points.cfHem.shift(45, 10),
})
2019-03-03 16:04:24 +01:00
if (sa) {
2019-08-03 15:03:33 +02:00
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
2019-03-03 16:04:24 +01:00
}
}
// Paperless?
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('hd', {
2019-03-03 16:04:24 +01:00
from: points.cfHem,
to: points.pocketHem,
2021-04-24 10:16:31 +02:00
y: points.cfHem.y + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-03 16:04:24 +01:00
from: points.cfHem,
to: points.pocketTip,
2021-04-24 10:16:31 +02:00
y: points.cfHem.y + sa + 30,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-03 16:04:24 +01:00
from: points.pocketCfTop,
to: points.pocketTopRight,
2021-04-24 10:16:31 +02:00
y: points.pocketCfTop.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-03 16:04:24 +01:00
from: points.cfHem,
to: points.pocketCfTop,
2021-04-24 10:16:31 +02:00
x: points.cfHem.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-03 16:04:24 +01:00
from: points.pocketHem,
to: points.pocketTip,
2021-04-24 10:16:31 +02:00
x: points.pocketTip.x + sa + 15,
2019-08-03 15:03:33 +02:00
})
2019-03-03 16:04:24 +01:00
}
2019-08-03 15:03:33 +02:00
return part
2019-03-03 16:04:24 +01:00
}
2022-09-05 19:05:02 -07:00
export const pocket = {
name: 'huey.pocket',
from: front,
draft: draftHueyPocket,
}