1
0
Fork 0
freesewing/designs/noble/src/backInside.mjs

154 lines
3.9 KiB
JavaScript
Raw Normal View History

2022-06-19 23:23:10 +00:00
export default function (part) {
2022-07-10 16:09:59 +02:00
const {
2022-06-19 23:23:10 +00:00
sa,
points,
Path,
paths,
Snippet,
snippets,
options,
complete,
paperless,
macro,
} = part.shorthand()
2022-06-21 02:09:57 +00:00
if( options.dartPosition != 'shoulder' ) {
paths.insideSeam = paths.seam.clone().setRender(true)
} else {
// Hide Bella paths
for (let key of Object.keys(paths)) paths[key].render = false
for (let i in snippets) delete snippets[i]
paths.insideSeam = new Path()
.move(points.cbNeck)
.curve_(points.cbNeckCp2, points.waistCenter)
.line(points.dartBottomLeft)
.curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip)
.curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart)
.line(points.hps)
._curve(points.cbNeckCp1, points.cbNeck)
.close()
.attr('class', 'fabric')
}
2022-06-19 23:23:10 +00:00
if (complete) {
2022-06-20 20:54:07 +00:00
snippets.dartTip = new Snippet('notch', points.dartTip)
2022-06-19 23:23:10 +00:00
macro('title', {
at: points.titleAnchor,
nr: 3,
2022-06-21 02:09:57 +00:00
title: ( options.dartPosition != 'shoulder' ? 'Back' : 'Inside Back' )
2022-06-19 23:23:10 +00:00
})
macro("grainline", {
from: points.grainlineFrom,
to: points.grainlineTo,
})
if (sa) paths.sa = paths.insideSeam.offset(sa).attr('class', 'fabric sa')
2022-06-20 20:54:07 +00:00
if( paperless ) {
2022-06-21 02:09:57 +00:00
if( options.dartPosition == 'shoulder' ) {
points.shoulderPoint = points.shoulderDart.clone()
} else {
points.shoulderPoint = points.shoulder.clone()
}
2022-06-20 20:54:07 +00:00
macro('hd', {
from: points.waistCenter,
2022-06-21 02:09:57 +00:00
to: points.shoulderPoint,
2022-06-20 20:54:07 +00:00
y: points.waistCenter.y +sa + 15,
})
macro('hd', {
from: points.waistCenter,
to: points.dartTip,
y: points.waistCenter.y +sa + 25,
})
macro('hd', {
from: points.waistCenter,
to: points.dartBottomLeft,
y: points.waistCenter.y +sa + 35,
})
macro('hd', {
from: points.cbNeck,
to: points.dartBottomLeft,
y: points.waistCenter.y +sa + 45,
})
macro('hd', {
from: points.cbNeck,
to: points.hps,
y: points.hps.y -sa - 15,
})
macro('hd', {
from: points.hps,
2022-06-21 02:09:57 +00:00
to: points.shoulderPoint,
2022-06-20 20:54:07 +00:00
y: points.hps.y -sa - 15,
})
2022-06-21 02:09:57 +00:00
if( options.dartPosition != 'shoulder' ) {
macro('hd', {
from: points.dartTip,
to: points.waistSide,
y: points.waistCenter.y +sa + 25,
})
macro('hd', {
from: points.dartBottomRight,
to: points.waistSide,
y: points.waistCenter.y +sa + 35,
})
macro('hd', {
from: points.dartBottomRight,
to: points.armhole,
y: points.waistCenter.y +sa + 45,
})
}
let extraOffset = 0
if( options.dartPosition != 'shoulder' ) {
macro('vd', {
from: points.shoulderPoint,
to: points.waistSide,
x: points.shoulderPoint.x +sa + 25,
})
macro('vd', {
from: points.armhole,
to: points.waistSide,
x: points.shoulderPoint.x +sa + 15,
})
extraOffset = 10
}
2022-06-20 20:54:07 +00:00
macro('vd', {
2022-06-21 02:09:57 +00:00
from: points.shoulderPoint,
2022-06-20 20:54:07 +00:00
to: points.dartTip,
2022-06-21 02:09:57 +00:00
x: points.shoulderPoint.x +sa + 15,
2022-06-20 20:54:07 +00:00
})
macro('vd', {
2022-06-21 02:09:57 +00:00
from: points.shoulderPoint,
2022-06-20 20:54:07 +00:00
to: points.dartBottomLeft,
2022-06-21 02:09:57 +00:00
x: points.shoulderPoint.x +sa + 25 +extraOffset,
2022-06-20 20:54:07 +00:00
})
macro('vd', {
2022-06-21 02:09:57 +00:00
from: points.shoulderPoint,
2022-06-20 20:54:07 +00:00
to: points.waistCenter,
2022-06-21 02:09:57 +00:00
x: points.shoulderPoint.x +sa + 35 +extraOffset,
2022-06-20 20:54:07 +00:00
})
macro('vd', {
from: points.hps,
to: points.waistCenter,
2022-06-21 02:09:57 +00:00
x: points.shoulderPoint.x +sa + 45 +extraOffset,
2022-06-20 20:54:07 +00:00
})
macro('vd', {
from: points.waistCenter,
to: points.cbNeck,
x: points.cbNeck.x -sa - 15,
})
macro('vd', {
from: points.waistCenter,
to: points.hps,
x: points.cbNeck.x -sa - 25,
})
}
2022-06-19 23:23:10 +00:00
}
2022-07-10 16:09:59 +02:00
2022-06-19 23:23:10 +00:00
return part
}