1
0
Fork 0
freesewing/packages/simon/src/cuff-barrel-rounded.js

54 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-08-03 15:03:33 +02:00
import { draftBarrelCuff, decorateBarrelCuff, paperlessBarrelCuff } from './shared'
2018-12-27 13:08:30 +01:00
2021-01-31 09:22:15 +01:00
export default (part) => {
2019-08-03 15:03:33 +02:00
let { store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand()
2018-12-27 13:08:30 +01:00
2019-08-03 15:03:33 +02:00
draftBarrelCuff(part)
let height = store.get('cuffHeight')
macro('round', {
2018-12-27 13:08:30 +01:00
from: points.topRight,
to: points.bottomLeft,
via: points.topLeft,
radius: height / 3,
2019-08-03 15:03:33 +02:00
prefix: 'topLeftRound'
})
macro('round', {
2018-12-27 13:08:30 +01:00
from: points.bottomRight,
to: points.topLeft,
via: points.topRight,
radius: height / 3,
2019-08-03 15:03:33 +02:00
prefix: 'topRightRound'
})
points.leftAngleBottom = points.topLeft.shift(-90, height / 3)
points.rightAngleTop = points.topRight.shift(180, height / 3)
points.rightAngleBottom = points.topRight.shift(-90, height / 3)
2018-12-27 13:08:30 +01:00
paths.seam = new Path()
.move(points.topLeftRoundEnd)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRightRoundStart)
2019-08-03 15:03:33 +02:00
.curve(points.topRightRoundCp1, points.topRightRoundCp2, points.topRightRoundEnd)
2018-12-27 13:08:30 +01:00
.line(points.topLeftRoundStart)
2019-08-03 15:03:33 +02:00
.curve(points.topLeftRoundCp1, points.topLeftRoundCp2, points.topLeftRoundEnd)
2018-12-27 13:08:30 +01:00
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2018-12-27 13:08:30 +01:00
// Complete pattern?
if (complete) {
2019-08-03 15:03:33 +02:00
decorateBarrelCuff(part)
if (sa) paths.sa = paths.seam.offset(sa)
2018-12-27 13:08:30 +01:00
}
// Paperless?
if (paperless) {
2019-08-03 15:03:33 +02:00
paperlessBarrelCuff(part)
macro('vd', {
2018-12-27 13:42:55 +01:00
from: points.topRightRoundStart,
to: points.topRightRoundEnd,
x: points.topRightRoundStart.x + 15 + sa
2019-08-03 15:03:33 +02:00
})
2018-12-27 13:08:30 +01:00
}
2019-08-03 15:03:33 +02:00
return part
}