1
0
Fork 0
freesewing/packages/brian/src/front.js

99 lines
2.4 KiB
JavaScript
Raw Normal View History

2019-08-03 15:03:33 +02:00
import * as shared from './shared'
2018-08-03 17:44:55 +02:00
export default (part) => {
let {
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
2021-04-24 10:16:31 +02:00
macro,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
// Cut arm a bit deeper at the front
let deeper = measurements.chest * options.frontArmholeDeeper
2019-08-03 15:03:33 +02:00
points.armholePitchCp1.x -= deeper
points.armholePitch.x -= deeper
points.armholePitchCp2.x -= deeper
// Rename cb (center back) to cf (center front)
2019-08-03 15:03:33 +02:00
for (let key of ['Shoulder', 'Armhole', 'Waist', 'Hips', 'Hem']) {
points[`cf${key}`] = new Point(points[`cb${key}`].x, points[`cb${key}`].y)
delete points[`cb${key}`]
}
// Front neckline points
2019-08-03 15:03:33 +02:00
points.neckCp2 = new Point(points.neckCp2Front.x, points.neckCp2Front.y)
2018-08-06 16:19:12 +02:00
// Seamline
2019-08-03 15:03:33 +02:00
paths.saBase = shared.saBase('front', points, Path)
paths.saBase.render = false
paths.seam = new Path()
.move(points.cfNeck)
2018-12-21 12:55:50 +01:00
.line(points.cfHem)
.join(paths.saBase)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
// Store lengths to fit sleeve
2019-08-03 15:03:33 +02:00
store.set('frontArmholeLength', shared.armholeLength(points, Path))
store.set('frontShoulderToArmholePitch', shared.shoulderToArmholePitch(points, Path))
// Complete pattern?
if (complete) {
2019-08-03 15:03:33 +02:00
macro('cutonfold', {
from: points.cfNeck,
to: points.cfHips,
2021-04-24 10:16:31 +02:00
grainline: true,
2019-08-03 15:03:33 +02:00
})
macro('title', { at: points.title, nr: 1, title: 'front' })
snippets.armholePitchNotch = new Snippet('notch', points.armholePitch)
2021-01-31 09:22:15 +01:00
paths.waist = new Path().move(points.cfWaist).line(points.waist).attr('class', 'help')
if (sa) {
paths.sa = paths.saBase
.offset(sa)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric sa')
.line(points.cfNeck)
2019-08-03 15:03:33 +02:00
.move(points.cfHips)
paths.sa.line(paths.sa.start())
}
}
2018-08-03 17:44:55 +02:00
// Paperless?
if (paperless) {
2019-08-03 15:03:33 +02:00
shared.dimensions(macro, points, Path, sa)
macro('hd', {
from: points.cfHips,
to: points.hips,
y: points.hem.y + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
from: points.cfHem,
to: points.cfWaist,
2021-04-24 10:16:31 +02:00
x: points.cfHips.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
from: points.cfHem,
to: points.cfNeck,
2021-04-24 10:16:31 +02:00
x: points.cfHips.x - sa - 30,
})
2019-08-03 15:03:33 +02:00
macro('hd', {
from: points.cfNeck,
to: points.neck,
2021-04-24 10:16:31 +02:00
y: points.neck.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
from: points.cfNeck,
to: points.shoulder,
2021-04-24 10:16:31 +02:00
y: points.neck.y - sa - 30,
2019-08-03 15:03:33 +02:00
})
2018-08-03 17:44:55 +02:00
}
2019-08-03 15:03:33 +02:00
return part
}