1
0
Fork 0
freesewing/packages/wahid/src/back.js
joostdecock c6ceaf2372 release: v2.18.0
## 2.18.0 (2021-09-09)

 ### core

 #### Fixed

  - Handle path.offset() of very short curves with control points on the start or end point Closes [#1257](https://github.com/freesewing/freesewing/issues/1257)

 ### holmes

 #### Fixed

  - The `brimWidth` option is not a percent option, allowing the pattern to scale properly

 ### huey

 #### Fixed

  - Replace cut-on-fold indicator on pocket with a regular grainline indicator Closes [#1265](https://github.com/freesewing/freesewing/issues/1265)

 ### i18n

 #### Added

  - Added translations for Yuri

 #### Fixed

  - Added optional chaining so missing options always lead to clear error message

 ### simon

 #### Fixed

  - Avoid paperless depending on a complete pattern

 ### theo

 #### Fixed

  - Avoid paperless depending on a complete pattern

 ### wahid

 #### Fixed

  - Close Seam Allowance path of front lining Closes [#1267](https://github.com/freesewing/freesewing/issues/1267)
  - Support a zero value for the `backScyeDart` option

 ### yuri
  - Handle path.offset() of very short curves with control points on the start or end point Closes [#1257](https://github.com/freesewing/freesewing/issues/1257)

  - The `brimWidth` option is not a percent option, allowing the pattern to scale properly

  - Replace cut-on-fold indicator on pocket with a regular grainline indicator Closes [#1265](https://github.com/freesewing/freesewing/issues/1265)

  - Added translations for Yuri

  - Added optional chaining so missing options always lead to clear error message

  - Avoid paperless depending on a complete pattern

  - Avoid paperless depending on a complete pattern

  - Close Seam Allowance path of front lining Closes [#1267](https://github.com/freesewing/freesewing/issues/1267)
  - Support a zero value for the `backScyeDart` option
2021-09-09 20:29:21 +02:00

217 lines
6.1 KiB
JavaScript

import { constructMainDart, shapeSideSeam, dartPath } from './shared'
export default (part) => {
let {
points,
Point,
paths,
Path,
measurements,
options,
macro,
complete,
sa,
paperless,
snippets,
} = part.shorthand()
// Cleanup from Brian
for (let i of Object.keys(paths)) delete paths[i]
delete snippets.armholePitchNotch
// Back inset
let shoulderLen = points.shoulder.dist(points.neck)
let backInset = shoulderLen * options.backInset
points.armholePitch = points.armholePitch.shift(180, backInset)
points.armholePitchCp1 = points.armholePitchCp1.shift(180, backInset)
points.armholePitchCp2 = points.armholePitchCp2.shift(180, backInset)
points.armholeHollow = points.armholeHollow.shift(180, backInset / 2)
points.armholeHollowCp2 = points.armholeHollowCp2.shift(180, backInset / 2)
points.armholeHollowCp1 = points.armholeHollowCp1.shift(180, backInset / 2)
// Shoulder inset
points.shoulder = points.shoulder.shiftTowards(points.neck, shoulderLen * options.shoulderInset)
points.shoulderCp1 = points.shoulderCp1.shift(
points.shoulder.angle(points.neck),
shoulderLen * options.shoulderInset
)
// Neck inset
points.neck = points.neck.shiftTowards(points.shoulder, shoulderLen * options.neckInset)
points.neckCp2 = points.neck.shift(points.shoulder.angle(points.neck) + 90, shoulderLen * 0.1)
// Center back dart
points.cbNeck = new Path()
.move(points.cbNeck)
._curve(points.neckCp2, points.neck)
.shiftAlong(measurements.shoulderToShoulder * options.centerBackDart)
points.cbNeckCp2 = new Point(0, points.armholePitch.y)
// Construct main dart
constructMainDart(part)
// Add dart start and end point regardless of style or front or back
points.dartStart = points.dartHemLeft
points.dartEnd = points.dartHemRight
// Shape side seam
shapeSideSeam(part)
// Back scye dart
points._dartWidth = points.cbNeckCp2.shiftFractionTowards(
points.armholePitch.rotate(options.backScyeDart, points.cbNeckCp2),
1.2
)
points.armholePitchTop =
options.backScyeDart > 0
? new Path()
.move(points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.intersects(new Path().move(points.cbNeckCp2).line(points._dartWidth))
.pop()
: points.armholePitch.clone()
// Rotate back scye dart into center back
let toRotate = ['cbNeck', 'neckCp2', 'neck', 'shoulder', 'shoulderCp1']
for (let p of toRotate) {
points[p] = points[p].rotate(options.backScyeDart, points.cbNeckCp2)
}
// Seam line
delete paths.cutonfold
delete paths.saBase
delete paths.sa
paths.saBase = new Path()
.move(points.hem)
.line(points.hips)
.curve(points.hipsCp2, points.waistCp1, points.waist)
.curve_(points.waistCp2, points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.line(points.neck)
.curve_(points.neckCp2, points.cbNeck)
._curve(points.cbNeckCp2, points.cbArmhole)
.line(points.cbHem)
paths.hemBase = new Path().move(points.cbHem).line(points.hem)
paths.dart = dartPath(part)
paths.seam = paths.saBase
.clone()
.line(points.dartHemLeft)
.join(paths.dart)
.line(points.hem)
.attr('class', 'fabric')
paths.saBase.render = false
paths.hemBase.render = false
paths.hemBase.render = false
paths.dart.render = false
if (complete) {
macro('scalebox', { at: new Point(points.logo.x, points.armholePitchCp2.y) })
if (sa) {
paths.sa = paths.saBase
.offset(sa)
.join(paths.hemBase.offset(sa * 3))
.close()
.attr('class', 'fabric sa')
}
if (paperless) {
macro('ld', {
from: points.neck,
to: points.shoulder,
d: 15 + sa,
})
macro('hd', {
from: points.cbArmhole,
to: points.cbNeck,
y: points.cbNeck.y - 15 - sa,
})
macro('hd', {
from: points.cbArmhole,
to: points.neck,
y: points.cbNeck.y - 30 - sa,
})
macro('hd', {
from: points.cbArmhole,
to: points.shoulder,
y: points.cbNeck.y - 45 - sa,
})
macro('hd', {
from: points.cbArmhole,
to: points.armholePitch,
y: points.armholePitch.y,
})
macro('hd', {
from: points.cbArmhole,
to: points.dartTop,
y: points.dartTop.y - 15,
})
macro('vd', {
from: points.armhole,
to: points.armholePitch,
x: points.armhole.x + 15 + sa,
})
macro('vd', {
from: points.armhole,
to: points.shoulder,
x: points.armhole.x + 30 + sa,
})
macro('vd', {
from: points.armhole,
to: points.neck,
x: points.armhole.x + 45 + sa,
})
macro('vd', {
from: points.hem,
to: points.waist,
x: points.armhole.x + 15 + sa,
})
macro('vd', {
from: points.hem,
to: points.armhole,
x: points.armhole.x + 30 + sa,
})
macro('hd', {
from: points.dartHemRight,
to: points.hem,
y: points.hem.y + 3 * sa + 15,
})
macro('hd', {
from: points.cbHem,
to: points.dartHemLeft,
y: points.hem.y + 3 * sa + 15,
})
macro('hd', {
from: points.cbHem,
to: points.hem,
y: points.hem.y + 3 * sa + 30,
})
macro('ld', {
from: points.dartWaistLeft,
to: points.dartWaistRight,
})
macro('ld', {
from: points.dartHipLeft,
to: points.dartHipRight,
})
macro('vd', {
from: points.cbHem,
to: points.cbArmhole,
x: points.cbHem.x - 15 - sa,
})
macro('vd', {
from: points.cbHem,
to: points.cbNeck,
x: points.cbHem.x - 30 - sa,
})
macro('vd', {
from: points.cbHem,
to: points.neck,
x: points.cbHem.x - 45 - sa,
})
}
}
return part
}