fix(bibi): Improve behavior with short lengths and low armholes. Fixes #6748
This commit is contained in:
parent
c169a80d77
commit
bad4611dc2
3 changed files with 29 additions and 19 deletions
|
@ -120,6 +120,7 @@ function bibiBack({
|
|||
complete,
|
||||
utils,
|
||||
part,
|
||||
log,
|
||||
}) {
|
||||
// Hide Brian paths
|
||||
for (const key of Object.keys(paths)) paths[key].hide()
|
||||
|
@ -147,7 +148,7 @@ function bibiBack({
|
|||
|
||||
points.cbHem = new Point(0, points.cbWaist.y + measurements.waistToHips * options.lengthBonus)
|
||||
|
||||
constructBackHem(points, measurements, options, Point, paths, Path)
|
||||
constructBackHem(points, measurements, options, Point, paths, Path, log)
|
||||
|
||||
store.set('backSideSeamLength', paths.sideSeam.length())
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ function bibiFront({
|
|||
complete,
|
||||
utils,
|
||||
part,
|
||||
log,
|
||||
}) {
|
||||
// Hide Brian paths
|
||||
for (const key of Object.keys(paths)) paths[key].hide()
|
||||
|
@ -136,7 +137,7 @@ function bibiFront({
|
|||
.move(points.neck)
|
||||
.curve(points.neckCp2, points.cfNeckCp1, points.cfNeck)
|
||||
.addClass('fabric')
|
||||
constructFrontHem(points, measurements, options, Point, paths, Path)
|
||||
constructFrontHem(points, measurements, options, Point, paths, Path, log)
|
||||
|
||||
store.set('frontSideSeamLength', paths.sideSeam.length())
|
||||
const frontLength = store.get('frontSideSeamLength')
|
||||
|
@ -145,14 +146,17 @@ function bibiFront({
|
|||
const constructDart = (path, tip, dartLength) => {
|
||||
const length = path.length()
|
||||
|
||||
dartLength = Math.max(0, Math.min(dartLength, length / 2))
|
||||
dartLength = Math.max(0, Math.min(dartLength, length))
|
||||
|
||||
const gatherArea = (store.get('gatherAreaLength') ?? 0) + dartLength
|
||||
const offset = length - (store.get('gatherAreaStart') ?? 0) - gatherArea
|
||||
// The length of both the beforeDart and afterDart paths,
|
||||
// which are used to create a smooth transition to the dart
|
||||
let auxLength = (gatherArea - dartLength) * 0.5
|
||||
|
||||
const offset = length - (store.get('gatherAreaStart') ?? 0) - gatherArea
|
||||
const startSplit = path.shiftAlong(offset)
|
||||
const startDartAlpha = path.shiftAlong(offset + (gatherArea - dartLength) * 0.5)
|
||||
const endDartAlpha = path.shiftAlong(offset + (gatherArea + dartLength) * 0.5)
|
||||
const startDartAlpha = path.shiftAlong(offset + auxLength)
|
||||
const endDartAlpha = path.shiftAlong(offset + auxLength + dartLength)
|
||||
const endSplit = path.shiftAlong(offset + gatherArea)
|
||||
|
||||
let tmp = path.split(startSplit)
|
||||
|
@ -162,8 +166,8 @@ function bibiFront({
|
|||
const pathAfter = tmp[1]
|
||||
const angleBefore = path.angleAt(startSplit)
|
||||
const angleAfter = path.angleAt(endSplit)
|
||||
const cpBefore = startSplit.shift(angleBefore, dartLength / 3)
|
||||
const cpAfter = endSplit.shift(angleAfter, -dartLength / 3)
|
||||
const cpBefore = startSplit.shift(angleBefore, auxLength / 3)
|
||||
const cpAfter = endSplit.shift(angleAfter, -auxLength / 3)
|
||||
|
||||
const dartDist = Math.max(tip.dist(startDartAlpha), tip.dist(endDartAlpha))
|
||||
|
||||
|
@ -183,8 +187,8 @@ function bibiFront({
|
|||
const dartAngle = dartAngleBefore * 2 - dartAngleMain
|
||||
let dartInnerAngle = tipShifted.angle(endDart) - tipShifted.angle(startDart)
|
||||
if (dartInnerAngle < -180) dartInnerAngle += 360
|
||||
const cpSplitStart = startDart.shift(dartAngle - dartInnerAngle / 2, -dartLength / 4)
|
||||
const cpSplitEnd = endDart.shift(dartAngle + dartInnerAngle / 2, dartLength / 4)
|
||||
const cpSplitStart = startDart.shift(dartAngle - dartInnerAngle / 2, -auxLength / 3)
|
||||
const cpSplitEnd = endDart.shift(dartAngle + dartInnerAngle / 2, auxLength / 3)
|
||||
|
||||
return {
|
||||
beforeDart: pathBefore.clone().curve(cpBefore, cpSplitStart, startDart),
|
||||
|
|
|
@ -243,7 +243,7 @@ function getBottomSmoothness(bottom, points) {
|
|||
return (Math.min(bottom, points.seat.y) - points.armhole.y) * 0.3
|
||||
}
|
||||
|
||||
export function constructBackHem(points, measurements, options, Point, paths, Path) {
|
||||
export function constructBackHem(points, measurements, options, Point, paths, Path, log) {
|
||||
let centerPoint
|
||||
|
||||
// Extra length for butt
|
||||
|
@ -280,11 +280,12 @@ export function constructBackHem(points, measurements, options, Point, paths, Pa
|
|||
centerPoint = points.cbSeat
|
||||
}
|
||||
|
||||
const hemBottom = centerPoint.y + bonusLengthMeasurement * options.lengthBonus
|
||||
points.cbHem = new Point(
|
||||
0,
|
||||
centerPoint.y + bonusLengthMeasurement * options.lengthBonus + extraBackLength
|
||||
)
|
||||
let hemBottom = centerPoint.y + bonusLengthMeasurement * options.lengthBonus
|
||||
if (hemBottom <= points.armhole.y * 1.1) {
|
||||
log.warn('Adjusting hem as it would be above or too close to armhole.')
|
||||
hemBottom = points.armhole.y * 1.1
|
||||
}
|
||||
points.cbHem = new Point(0, hemBottom + extraBackLength)
|
||||
points.midHem = new Point(points.hem.x * 0.66, points.cbHem.y)
|
||||
paths.sideSeam = constructSideSeam(
|
||||
Path,
|
||||
|
@ -300,7 +301,7 @@ export function constructBackHem(points, measurements, options, Point, paths, Pa
|
|||
.addClass('fabric')
|
||||
}
|
||||
|
||||
export function constructFrontHem(points, measurements, options, Point, paths, Path) {
|
||||
export function constructFrontHem(points, measurements, options, Point, paths, Path, log) {
|
||||
let centerPoint
|
||||
let bonusLengthMeasurement = measurements.hpsToWaistBack
|
||||
switch (options.length) {
|
||||
|
@ -331,8 +332,12 @@ export function constructFrontHem(points, measurements, options, Point, paths, P
|
|||
centerPoint = points.cfSeat
|
||||
}
|
||||
|
||||
const hemBottom = centerPoint.y + bonusLengthMeasurement * options.lengthBonus
|
||||
points.cfHem = new Point(0, centerPoint.y + bonusLengthMeasurement * options.lengthBonus)
|
||||
let hemBottom = centerPoint.y + bonusLengthMeasurement * options.lengthBonus
|
||||
if (hemBottom <= points.armhole.y * 1.1) {
|
||||
log.warn('Adjusting hem as it would be above or too close to armhole.')
|
||||
hemBottom = points.armhole.y * 1.1
|
||||
}
|
||||
points.cfHem = new Point(0, hemBottom)
|
||||
points.midHem = new Point(points.hem.x * 0.66, points.cfHem.y)
|
||||
paths.sideSeam = constructSideSeam(
|
||||
Path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue