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

74 lines
1.8 KiB
JavaScript
Raw Normal View History

export default function (part) {
2018-12-20 11:41:35 +01:00
// Remove clutter
2019-08-03 15:03:33 +02:00
let pocket = part.paths.pocket
part.paths = {}
part.snippets = {}
2018-09-21 21:30:20 +02:00
let { utils, store, sa, points, Path, paths, complete, paperless, macro } = part.shorthand()
2018-09-21 21:30:20 +02:00
paths.seam = pocket.line(points.cfRibbing).line(points.pocketHem).attr('class', 'fabric', true)
paths.seam.render = true
2018-09-21 21:30:20 +02:00
2019-08-03 15:03:33 +02:00
store.set('facingWidth', points.pocketHem.dist(points.pocketTip) / 2)
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
let facing = new Path()
.move(points.pocketTip)
.curve(points.pocketTip, points.pocketTopCp, points.pocketTop)
2019-08-03 15:03:33 +02:00
.offset(store.get('facingWidth') * -1)
2018-09-21 21:30:20 +02:00
2019-08-03 15:03:33 +02:00
points._tmp = facing.shiftAlong(2)
2018-12-20 11:41:35 +01:00
points.facingEnd = utils.beamsIntersect(
points._tmp,
facing.start(),
points.pocketHem,
points.pocketTip
2019-08-03 15:03:33 +02:00
)
2018-12-20 11:41:35 +01:00
paths.facing = new Path()
.move(points.facingEnd)
.line(facing.start())
.join(facing)
2019-08-03 15:03:33 +02:00
.attr('class', ' fabric help')
paths.facing.render = false
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Complete pattern?
if (complete) {
paths.facing.render = true
2021-03-02 12:33:31 -08:00
macro('cutonfold', {
from: points.pocketCf,
to: points.cfRibbing,
2021-04-24 10:16:31 +02:00
grainline: true,
2019-08-03 15:03:33 +02:00
})
points.title = points.cfRibbing.shiftFractionTowards(points.pocketTop, 0.5)
macro('title', { at: points.title, nr: 4, title: 'pocket' })
2018-12-20 11:41:35 +01:00
if (sa) {
2019-08-03 15:03:33 +02:00
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
2018-09-21 21:30:20 +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('hd', {
2018-12-20 11:41:35 +01:00
from: points.cfRibbing,
to: points.pocketTop,
2021-04-24 10:16:31 +02:00
y: points.cfRibbing.y + 15 + sa,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2018-12-20 11:41:35 +01:00
from: points.cfRibbing,
to: points.pocketTip,
2021-04-24 10:16:31 +02:00
y: points.cfRibbing.y + 30 + sa,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2018-12-20 11:41:35 +01:00
from: points.pocketHem,
to: points.pocketTip,
2021-04-24 10:16:31 +02:00
x: points.pocketTip.x + 15 + sa,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2018-12-20 11:41:35 +01:00
from: points.pocketHem,
to: points.pocketTop,
2021-04-24 10:16:31 +02:00
x: points.cfRibbing.x - 15 - sa,
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
}