1
0
Fork 0
freesewing/designs/ursula/src/gusset.mjs

80 lines
2.2 KiB
JavaScript
Raw Normal View History

export default function (part) {
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:25:59 +02:00
let { options, Point, Path, points, paths, measurements, store, complete, sa, paperless, macro } =
part.shorthand()
// Create points
points.frontGussetLeft = new Point(store.get('frontGussetLeft').x, 0)
2021-08-30 11:40:16 +02:00
points.backGussetLeft = new Point(
store.get('backGussetLeft').x,
measurements.seat * options.gussetLength
)
points.frontGussetRight = new Point(store.get('frontGussetRight').x, 0)
2021-08-30 11:40:16 +02:00
points.backGussetRight = new Point(
store.get('backGussetRight').x,
measurements.seat * options.gussetLength
)
// Create control points
2021-08-30 11:40:16 +02:00
points.gussetCp1 = points.frontGussetLeft
.shiftFractionTowards(points.backGussetLeft, 0.5)
.shift(180, points.frontGussetRight.x / -15)
// Flip points to right side
points.gussetCp2 = points.gussetCp1.flipX(store.get('frontGussetMid'))
// Create point for title
points.frontMidMid = points.gussetCp1.shiftFractionTowards(points.gussetCp2, 0.5)
/* Store lengths for use in elastic */
store.set(
'gussetSideLength',
new Path()
.move(points.backGussetRight)
.curve(points.backGussetRight, points.gussetCp2, points.frontGussetRight)
.length()
)
// Draw paths
paths.seam = new Path()
.move(points.frontGussetLeft)
.curve(points.gussetCp1, points.backGussetLeft, points.backGussetLeft)
.line(points.backGussetRight)
.curve(points.backGussetRight, points.gussetCp2, points.frontGussetRight)
.line(points.frontGussetLeft) // Without this, doesn't generate seam allowance
.close()
.attr('class', 'fabric')
// Complete?
if (complete) {
if (sa) {
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
}
2021-09-04 17:52:13 +02:00
macro('title', {
at: points.frontMidMid,
nr: 3,
title: 'gusset',
})
}
// Paperless?
if (paperless) {
macro('hd', {
from: points.frontGussetLeft,
to: points.frontGussetRight,
y: points.frontGussetLeft.y + sa + 15,
})
macro('hd', {
from: points.backGussetLeft,
to: points.backGussetRight,
y: points.backGussetLeft.y + sa + 15,
})
macro('vd', {
from: points.frontGussetRight,
to: points.backGussetRight,
x: points.frontGussetRight.x + sa + 15,
})
}
return part
}