1
0
Fork 0
freesewing/packages/carlton/src/undersleeve.js

121 lines
3 KiB
JavaScript
Raw Normal View History

2019-03-25 18:20:15 +01:00
export default function(part) {
2019-08-03 15:03:33 +02:00
let {
paperless,
sa,
store,
complete,
points,
measurements,
options,
macro,
Point,
paths,
Path
} = part.shorthand()
2019-03-25 18:20:15 +01:00
// Add cuff
2019-08-03 15:03:33 +02:00
let length = measurements.shoulderToWrist * options.cuffLength
let angle = points.usWristRight.angle(points.usWristLeft)
points.cuffBottomRight = points.usWristRight.shift(angle + 90, length)
points.cuffBottomLeft = points.usWristLeft.shift(angle + 90, length)
macro('round', {
2019-03-25 18:20:15 +01:00
to: points.usWristRight,
from: points.cuffBottomLeft,
via: points.cuffBottomRight,
2019-08-03 15:03:33 +02:00
radius: length / 3,
2019-03-25 18:20:15 +01:00
render: true,
2019-08-03 15:03:33 +02:00
prefix: 'round'
})
store.set('underCuffWidth', points.usWristLeft.dist(points.usWristRight))
2019-03-25 18:20:15 +01:00
2019-03-29 07:29:30 +01:00
// Clean up
2019-08-03 15:03:33 +02:00
for (let i in paths) delete paths[i]
2019-03-29 07:29:30 +01:00
2019-03-25 18:20:15 +01:00
// Paths
paths.seam = new Path()
.move(points.usLeftEdge)
._curve(points.usElbowLeftCpTop, points.usElbowLeft)
.line(points.usWristLeft)
.line(points.cuffBottomLeft)
.line(points.roundStart)
.curve(points.roundCp1, points.roundCp2, points.roundEnd)
.line(points.usWristRight)
.line(points.elbowRight)
.curve(points.elbowRightCpTop, points.usRightEdgeCpBottom, points.usRightEdge)
.curve_(points.usRightEdgeCpTop, points.usTip)
.curve(points.usTipCpBottom, points.usLeftEdgeCpRight, points.usLeftEdgeRight)
.line(points.usLeftEdge)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2019-03-25 18:20:15 +01:00
2019-03-29 07:29:30 +01:00
if (complete) {
2019-08-03 15:03:33 +02:00
macro('grainline', {
2019-03-29 07:29:30 +01:00
from: points.boxBottom,
2019-08-03 15:03:33 +02:00
to: new Point(points.top.x, points.usLeftEdge.y)
})
2019-03-29 07:29:30 +01:00
if (sa) {
2019-08-03 15:03:33 +02:00
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
2019-03-29 07:29:30 +01:00
}
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('ld', {
2019-03-29 07:29:30 +01:00
from: points.usWristLeft,
to: points.usWristRight,
d: -15
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-29 07:29:30 +01:00
from: points.usWristLeft,
to: points.usElbowLeft,
x: points.usLeftEdge.x - sa - 15
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-29 07:29:30 +01:00
from: points.usWristLeft,
to: points.usLeftEdge,
x: points.usLeftEdge.x - sa - 30
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-29 07:29:30 +01:00
from: points.cuffBottomLeft,
to: points.usWristLeft,
d: 15 + sa
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-29 07:29:30 +01:00
from: points.cuffBottomRight,
to: points.usWristRight,
x: points.usWristRight.x + 15 + sa
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-29 07:29:30 +01:00
from: points.usWristRight,
to: points.elbowRight,
x: points.elbowRight.x + 15 + sa
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-29 07:29:30 +01:00
from: points.usWristRight,
to: points.usTip,
x: points.elbowRight.x + 30 + sa
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-29 07:29:30 +01:00
from: points.usElbowLeft,
to: points.elbowRight
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-29 07:29:30 +01:00
from: points.usLeftEdge,
to: points.usRightEdge,
d: -15
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-29 07:29:30 +01:00
from: points.usLeftEdge,
to: points.usTip,
y: points.usTip.y - sa - 15
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-29 07:29:30 +01:00
from: points.usLeftEdge,
to: points.usTip,
x: points.usLeftEdge.x - sa - 15
2019-08-03 15:03:33 +02:00
})
2019-03-29 07:29:30 +01:00
}
}
2019-08-03 15:03:33 +02:00
return part
2019-03-25 18:20:15 +01:00
}