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

122 lines
3 KiB
JavaScript
Raw Normal View History

2022-09-03 14:46:40 +02:00
/*
* We don't move this draft method under the part object
* because doing so changes the indentation which causes
* us to lose all history of changes to this method.
*
* So to maintain the history of contributions over the
* years, keeps this method here, and resist the urge to
* move it into the named export at the bottom of this file.
*/
function waraleePocket(part) {
const {
options,
measurements,
Point,
Path,
points,
paths,
Snippet,
snippets,
complete,
sa,
paperless,
2021-04-24 10:16:31 +02:00
macro,
} = part.shorthand()
2022-09-03 14:46:40 +02:00
const pocketDepth =
(measurements.crotchDepth - measurements.waistToHips) * options.frontPocketDepthFactor
points.topLeft = new Point(0, 0)
points.bottomLeft = points.topLeft.shift(270, pocketDepth)
points.topRight = points.topLeft.shift(0, pocketDepth * (1 / 3))
points.bottomRight = points.topRight.shift(290, pocketDepth * (5 / 6))
points.bottomLeftCP = points.bottomLeft.shift(0, pocketDepth * (1 / 6))
points.bottomRightCP = points.bottomRight.shift(225, pocketDepth * (1 / 4))
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.curve(points.bottomLeftCP, points.bottomRightCP, points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'fabric')
// Complete?
if (complete) {
macro('cutonfold', {
from: points.topLeft,
to: points.bottomLeft,
margin: 5,
2021-04-24 10:16:31 +02:00
offset: 10,
})
points.title = points.topLeft.shift(270, 75).shift(0, 50)
macro('title', {
nr: 3,
at: points.title,
2021-04-24 10:16:31 +02:00
title: 'pocket',
})
points.logo = points.title.shift(270, 75)
snippets.logo = new Snippet('logo', points.logo)
points.text = points.logo
.shift(-90, 25)
.attr('data-text', 'Waralee')
.attr('data-text-class', 'center')
if (sa) {
paths.sa = new Path()
.move(points.bottomLeft)
.join(
new Path()
.move(points.bottomLeft)
.curve(points.bottomLeftCP, points.bottomRightCP, points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.offset(sa)
)
.line(points.topLeft)
.attr('class', 'fabric sa')
}
}
// Paperless?
if (paperless) {
macro('hd', {
from: points.topLeft,
to: points.topRight,
2021-04-24 10:16:31 +02:00
y: points.topLeft.y + 15,
})
macro('hd', {
from: points.bottomLeft,
to: points.bottomRight,
2021-04-24 10:16:31 +02:00
y: points.bottomRight.y,
})
macro('vd', {
from: points.topLeft,
to: points.bottomLeft,
2021-04-24 10:16:31 +02:00
x: points.topLeft.x + 15,
})
macro('vd', {
from: points.topRight,
to: points.bottomRight,
2021-04-24 10:16:31 +02:00
x: points.bottomRight.x,
})
macro('vd', {
from: points.bottomRight,
to: points.bottomLeft,
2021-04-24 10:16:31 +02:00
x: points.bottomRight.x,
})
}
return part
}
2022-09-03 14:46:40 +02:00
export const pocket = {
name: 'waralee.pocket',
measurements: ['crotchDepth', 'waistToHips'],
draft: waraleePocket,
}