1
0
Fork 0
freesewing/packages/hugo/src/cuff.js

61 lines
1.4 KiB
JavaScript
Raw Normal View History

export default function (part) {
let {
measurements,
options,
sa,
Point,
points,
Path,
paths,
complete,
paperless,
2021-04-24 10:16:31 +02:00
macro,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2018-09-21 21:30:20 +02:00
let width = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight * 2
let length = measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch)
2018-09-21 21:30:20 +02:00
2019-08-03 15:03:33 +02:00
points.topLeft = new Point(0, 0)
points.bottomLeft = new Point(0, width)
points.topRight = new Point(length, 0)
points.bottomRight = new Point(length, width)
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
2021-02-07 11:55:40 +01:00
.attr('class', 'various')
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Complete pattern?
if (complete) {
if (sa) {
2021-02-07 11:55:40 +01:00
paths.sa = paths.seam.offset(sa).attr('class', 'various sa')
2018-09-21 21:30:20 +02:00
}
2019-08-03 15:03:33 +02:00
points.title = points.bottomLeft.shiftFractionTowards(points.topRight, 0.5)
macro('title', { at: points.title, nr: 9, title: 'cuff' })
macro('grainline', {
2018-12-20 11:41:35 +01:00
from: points.bottomLeft.shift(0, 20),
2021-04-24 10:16:31 +02:00
to: points.topLeft.shift(0, 20),
2019-08-03 15:03:33 +02:00
})
2018-12-20 11:41:35 +01:00
}
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Paperless?
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('vd', {
2018-12-20 11:41:35 +01:00
from: points.bottomRight,
to: points.topRight,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2018-12-20 11:41:35 +01:00
from: points.bottomLeft,
to: points.bottomRight,
2021-04-24 10:16:31 +02:00
y: points.bottomRight.y + sa + 15,
2019-08-03 15:03:33 +02:00
})
2018-09-21 21:30:20 +02:00
}
2019-08-03 15:03:33 +02:00
return part
}