1
0
Fork 0
freesewing/designs/cornelius/src/pocketfacing.mjs

100 lines
2.9 KiB
JavaScript
Raw Normal View History

2021-02-18 07:47:53 -08:00
export default function (part) {
2021-08-30 11:40:16 +02:00
let { Path, Point, points, paths, Snippet, snippets, complete, sa, store, paperless, macro } =
part.shorthand()
2021-02-18 07:47:53 -08:00
2021-03-09 17:43:06 +01:00
let halfInch = store.get('halfInch')
let waist = store.get('waist')
2021-02-18 07:47:53 -08:00
2021-03-09 17:43:06 +01:00
paths.waistSeam = paths.waistSeam.split(points.pocketFacingTL)[0].setRender(false)
2021-02-18 07:47:53 -08:00
2021-02-25 07:50:08 -08:00
// Adding sa to this point so it allows for the pocket seam to be finished without the facing being included
2021-03-09 17:43:06 +01:00
points.pocketFacingBR = paths.sideSeam.shiftAlong(
paths.sideSeam.length() - (waist / 2 / 4.5) * 3.5 - halfInch * 3 + sa
)
// If we split at the exact point where the curves join, things fall apart
// So let's work around that until this is handled in core
if (points.pocketFacingBR.sitsOn(points.pAextra))
paths.sideSeam = new Path()
.move(points.pAextra)
.curve(points.pAextraCPu, points.pUcpA, points.pU)
.setRender(false)
else paths.sideSeam = paths.sideSeam.split(points.pocketFacingBR)[1].setRender(false)
2021-03-09 17:43:06 +01:00
points.brCPtl = points.pocketFacingBR.shift(
points.pocketFacingBR.angle(points.pocketSide) + 90,
halfInch * 3
)
points.tlCPbr = points.pocketFacingTL.shift(
points.pocketFacingTL.angle(points.pocketWaist) - 90,
halfInch * 6
)
2021-02-18 07:47:53 -08:00
2021-02-25 07:50:08 -08:00
paths.facingInside = new Path()
2021-03-09 17:43:06 +01:00
.move(points.pocketFacingTL)
.curve(points.tlCPbr, points.brCPtl, points.pocketFacingBR)
.setRender(false)
2021-02-18 07:47:53 -08:00
2021-02-25 07:50:08 -08:00
paths.seam = paths.waistSeam
2021-03-09 17:43:06 +01:00
.join(paths.facingInside)
.join(paths.sideSeam)
2021-02-25 07:50:08 -08:00
.close()
2021-03-09 17:43:06 +01:00
.setRender(true)
2021-02-25 07:50:08 -08:00
.attr('class', 'fabric')
2021-03-09 17:43:06 +01:00
if (complete) {
snippets.n1 = new Snippet('notch', points.pocketWaist)
snippets.n2 = new Snippet('notch', points.pocketSide)
2021-02-25 07:50:08 -08:00
2021-03-09 17:43:06 +01:00
points.logo = points.pUcpA.shiftFractionTowards(points.pocketFacingTL, 0.5).shift(270, 30)
2021-02-25 07:50:08 -08:00
snippets.logo = new Snippet('logo', points.logo)
points.title = points.logo.shift(270, 50)
macro('title', {
nr: 3,
at: points.title,
2021-04-24 10:16:31 +02:00
title: 'PocketFacing',
2021-02-25 07:50:08 -08:00
})
// points.__titleNr.attr('data-text-class', 'center')
// points.__titleName.attr('data-text-class', 'center')
// points.__titlePattern.attr('data-text-class', 'center')
2021-03-01 07:26:44 -08:00
macro('grainline', {
from: points.pU,
2021-04-24 10:16:31 +02:00
to: new Point(points.pU.x, points.__titleNr.y),
2021-03-01 07:26:44 -08:00
})
2021-02-25 07:50:08 -08:00
2021-03-09 17:43:06 +01:00
if (sa) {
2021-02-25 07:50:08 -08:00
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
2021-02-18 07:47:53 -08:00
}
}
2021-02-25 07:50:08 -08:00
// Paperless?
if (paperless) {
macro('hd', {
from: points.pU,
to: points.pocketSide,
2021-04-24 10:16:31 +02:00
y: points.pU.y - sa - 15,
2021-02-25 07:50:08 -08:00
})
macro('hd', {
from: points.pU,
to: points.pocketWaist,
2021-04-24 10:16:31 +02:00
y: points.pU.y - sa - 15,
2021-02-25 07:50:08 -08:00
})
macro('hd', {
from: points.pocketWaist,
to: points.pocketFacingTL,
2021-04-24 10:16:31 +02:00
y: points.pU.y - sa - 15,
2021-02-25 07:50:08 -08:00
})
macro('vd', {
from: points.pU,
to: points.pocketSide,
2021-04-24 10:16:31 +02:00
x: points.pocketSide.x + sa + 15,
2021-02-25 07:50:08 -08:00
})
macro('vd', {
from: points.pocketSide,
to: points.pocketFacingBR,
2021-04-24 10:16:31 +02:00
x: points.pocketSide.x + sa + 15,
2021-02-25 07:50:08 -08:00
})
}
return part
}