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

87 lines
2.1 KiB
JavaScript
Raw Normal View History

import { front } from './front.mjs'
2022-08-28 16:49:21 +02:00
export const pocket = {
name: 'albert.pocket',
after: front,
2022-09-10 19:47:11 +02:00
draft: ({
Point,
Path,
points,
paths,
Snippet,
snippets,
complete,
sa,
paperless,
macro,
store,
2022-09-10 19:47:11 +02:00
part,
}) => {
let pocketSize = store.get('pocketSize')
let hemWidth = store.get('hemWidth')
2022-08-28 16:49:21 +02:00
points.topLeft = new Point(0, 0)
points.topRight = new Point(pocketSize, 0)
points.topLeftHem = points.topLeft.shift(270, hemWidth)
points.topRightHem = points.topRight.shift(270, hemWidth)
points.bottomLeft = points.topLeftHem.shift(270, pocketSize)
points.bottomRight = points.topRightHem.shift(270, pocketSize)
points.topCOF = points.topLeft.shift(270, pocketSize / 5)
points.bottomCOF = points.bottomLeft.shift(90, pocketSize / 5)
paths.seam = new Path()
.move(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'fabric')
paths.all = paths.seam.clone().line(points.bottomLeft).close().attr('class', 'fabric')
paths.topHem = new Path()
.move(points.topLeftHem)
.line(points.topRightHem.shift(0, sa))
.attr('class', 'various dashed')
.attr('data-text', 'hem')
.attr('data-text-class', 'text-xs center')
macro('cutonfold', {
from: points.topCOF,
to: points.bottomCOF,
})
// Complete?
if (complete) {
points.logo = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)
snippets.logo = new Snippet('logo', points.logo)
points.title = points.logo.shift(-90, 45)
macro('title', {
nr: 3,
at: points.title,
title: 'Pocket',
})
if (sa) {
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
}
}
// Paperless?
if (paperless) {
macro('hd', {
from: points.bottomLeft,
to: points.bottomRight,
y: points.bottomLeft.y + sa + 15,
})
macro('vd', {
from: points.bottomLeft,
to: points.topLeft,
x: points.topLeft.x - sa - 15,
})
}
return part
2022-09-10 20:26:11 +02:00
},
2022-08-28 16:49:21 +02:00
}