2022-09-05 12:24:23 -07:00
|
|
|
import { pluginBundle } from '@freesewing/plugin-bundle'
|
|
|
|
|
2022-09-11 14:28:25 +02:00
|
|
|
function draftFlorentBrimBottom({
|
|
|
|
paperless,
|
|
|
|
sa,
|
|
|
|
store,
|
|
|
|
complete,
|
|
|
|
points,
|
|
|
|
options,
|
|
|
|
macro,
|
|
|
|
Point,
|
|
|
|
paths,
|
|
|
|
Path,
|
|
|
|
measurements,
|
|
|
|
part,
|
|
|
|
}) {
|
2019-08-03 15:03:33 +02:00
|
|
|
let scale = 1
|
2020-06-29 19:51:22 +02:00
|
|
|
let base = scale * measurements.head * (1 + options.headEase)
|
2019-04-07 17:01:58 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
points.tipRight = new Point(base * 0.147, 0)
|
|
|
|
points.tipLeft = points.tipRight.flipX()
|
|
|
|
points.tipRightCp2 = points.tipRight.shift(-115, base * 0.051)
|
|
|
|
points.tipLeftCp1 = points.tipRightCp2.flipX()
|
|
|
|
points.tipRightCp1 = points.tipRight.shift(-75, base * 0.195)
|
|
|
|
points.tipLeftCp2 = points.tipRightCp1.flipX()
|
|
|
|
points.innerMid = new Point(0, base * 0.13)
|
|
|
|
points.outerMid = new Point(0, base * 0.226)
|
|
|
|
points.innerMidCp2 = points.innerMid.shift(180, base * 0.13)
|
|
|
|
points.innerMidCp1 = points.innerMidCp2.flipX()
|
|
|
|
points.outerMidCp1 = points.outerMid.shift(180, base * 0.066)
|
|
|
|
points.outerMidCp2 = points.outerMidCp1.flipX()
|
2019-04-07 17:01:58 +02:00
|
|
|
|
|
|
|
store.set(
|
2019-08-03 15:03:33 +02:00
|
|
|
'brimInnerLength',
|
2019-04-07 17:01:58 +02:00
|
|
|
new Path()
|
|
|
|
.move(points.tipRight)
|
|
|
|
.curve(points.tipRightCp2, points.innerMidCp1, points.innerMid)
|
|
|
|
.length() * 2
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
2019-04-07 17:01:58 +02:00
|
|
|
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.tipLeft)
|
|
|
|
.curve(points.tipLeftCp2, points.outerMidCp1, points.outerMid)
|
|
|
|
.curve(points.outerMidCp2, points.tipRightCp1, points.tipRight)
|
|
|
|
.curve(points.tipRightCp2, points.innerMidCp1, points.innerMid)
|
|
|
|
.curve(points.innerMidCp2, points.tipLeftCp1, points.tipLeft)
|
|
|
|
.line(points.tipLeft)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric')
|
2019-04-07 17:01:58 +02:00
|
|
|
|
2023-04-30 05:47:24 -07:00
|
|
|
macro('grainline', {
|
|
|
|
from: points.outerMid,
|
|
|
|
to: points.innerMid,
|
|
|
|
})
|
|
|
|
|
2019-04-07 17:01:58 +02:00
|
|
|
if (complete) {
|
2019-08-03 15:03:33 +02:00
|
|
|
points.title = points.innerMid.shiftFractionTowards(points.outerMidCp2, 0.35)
|
|
|
|
macro('title', {
|
2019-04-08 18:25:01 +02:00
|
|
|
at: points.title,
|
|
|
|
nr: 3,
|
2021-04-24 10:16:31 +02:00
|
|
|
title: 'brimBottom',
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2021-05-23 13:10:03 +02:00
|
|
|
macro('sprinkle', {
|
|
|
|
snippet: 'notch',
|
2021-08-30 11:40:16 +02:00
|
|
|
on: ['innerMid', 'outerMid'],
|
2021-05-23 13:10:03 +02:00
|
|
|
})
|
2019-04-08 18:25:01 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
2019-04-07 17:01:58 +02:00
|
|
|
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2019-04-08 18:25:01 +02:00
|
|
|
from: points.tipLeft,
|
|
|
|
to: points.tipRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.tipLeft.y - sa - 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
|
|
|
from: paths.seam.edge('left'),
|
|
|
|
to: paths.seam.edge('right'),
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.tipLeft.y - sa - 30,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-04-08 18:25:01 +02:00
|
|
|
from: points.outerMid,
|
|
|
|
to: points.innerMid,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.innerMid.x - 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-04-08 18:25:01 +02:00
|
|
|
from: points.outerMid,
|
|
|
|
to: points.tipRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.tipRight.x + sa + 18,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-04-07 17:01:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-04-07 17:01:58 +02:00
|
|
|
}
|
2022-09-05 12:24:23 -07:00
|
|
|
|
|
|
|
export const brimBottom = {
|
|
|
|
name: 'florent.brimBottom',
|
2022-09-11 14:28:25 +02:00
|
|
|
measurements: ['head'],
|
|
|
|
options: {
|
2022-09-05 12:24:23 -07:00
|
|
|
// Constants
|
|
|
|
topSide: 0.8,
|
|
|
|
brim: 0,
|
|
|
|
// Percentages
|
|
|
|
headEase: { pct: 2, min: 0, max: 5, menu: 'fit' },
|
|
|
|
},
|
2022-09-11 14:28:25 +02:00
|
|
|
plugins: [pluginBundle],
|
2022-09-05 12:24:23 -07:00
|
|
|
draft: draftFlorentBrimBottom,
|
|
|
|
}
|