2019-08-03 15:03:33 +02:00
|
|
|
import { addButtons } from './shared'
|
2018-12-22 17:30:12 +01:00
|
|
|
|
2021-01-31 09:22:15 +01:00
|
|
|
export default (part) => {
|
2022-01-09 16:06:57 +01:00
|
|
|
const { sa, store, Point, points, Path, paths, complete, paperless, macro, options, utils } =
|
2021-09-28 19:28:23 +02:00
|
|
|
part.shorthand()
|
2018-12-22 17:30:12 +01:00
|
|
|
|
2021-09-12 15:29:59 +02:00
|
|
|
const width = store.get('buttonPlacketWidth')
|
2019-08-03 15:03:33 +02:00
|
|
|
points.placketTopFold1 = points.cfNeck.shift(0, width / 2)
|
|
|
|
points.placketTopFold2 = points.cfNeck.shift(0, width * 1.5)
|
|
|
|
points.placketTopEdge = points.cfNeck.shift(0, width * 2.5)
|
2022-01-08 19:56:21 +01:00
|
|
|
points.placketTopIn = points.cfNeck.shift(180, width / 2)
|
2019-08-03 15:03:33 +02:00
|
|
|
points.placketBottomFold1 = points.cfHem.shift(0, width / 2)
|
|
|
|
points.placketBottomFold2 = points.cfHem.shift(0, width * 1.5)
|
|
|
|
points.placketBottomEdge = points.cfHem.shift(0, width * 2.5)
|
2022-01-08 19:56:21 +01:00
|
|
|
points.placketBottomIn = points.cfHem.shift(180, width / 2)
|
|
|
|
|
|
|
|
const buttonholePlacketWidth = store.get('buttonholePlacketWidth')
|
2022-01-09 16:06:57 +01:00
|
|
|
const fold = options.buttonholePlacketStyle === 'seamless' ? 0 : store.get('buttonholePlacketFoldWidth')
|
|
|
|
points.placketTopMatch = utils.lineIntersectsCurve(
|
|
|
|
new Point(-(buttonholePlacketWidth / 2 - fold), points.cfNeck.y + 20),
|
|
|
|
new Point(-(buttonholePlacketWidth / 2 - fold), points.cfNeck.y - 20),
|
|
|
|
points.cfNeck,
|
|
|
|
points.cfNeckCp1,
|
|
|
|
points.neckCp2Front,
|
|
|
|
points.neck
|
|
|
|
)
|
|
|
|
points.placketBottomMatch = points.cfHem.shift(180, buttonholePlacketWidth / 2 - fold)
|
2022-01-08 19:56:21 +01:00
|
|
|
|
2021-01-31 09:22:15 +01:00
|
|
|
paths.seam.line(points.placketTopEdge).line(points.placketBottomEdge).line(points.cfHem).close()
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
|
|
|
// Placket help lines
|
2021-01-31 09:22:15 +01:00
|
|
|
paths.frontCenter = new Path().move(points.cfNeck).line(points.cfHem).attr('class', 'help')
|
2018-12-22 17:30:12 +01:00
|
|
|
paths.placketFold1 = new Path()
|
|
|
|
.move(points.placketTopFold1)
|
|
|
|
.line(points.placketBottomFold1)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'dotted')
|
2018-12-22 17:30:12 +01:00
|
|
|
paths.placketFold2 = new Path()
|
|
|
|
.move(points.placketTopFold2)
|
|
|
|
.line(points.placketBottomFold2)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'dotted')
|
2022-01-08 19:56:21 +01:00
|
|
|
paths.placketInnerFold = new Path()
|
|
|
|
.move(points.placketBottomIn)
|
|
|
|
.line(points.placketTopIn)
|
|
|
|
.attr('class', 'dotted')
|
|
|
|
if (!options.seperateButtonholePlacket) {
|
|
|
|
// Match lines are only displayed on attached plackets
|
|
|
|
if (Math.abs(points.placketTopIn.x - points.placketTopMatch.x) < 0.5) {
|
|
|
|
// Match line is nearly the same as the inner fold line.
|
|
|
|
paths.placketInnerFold
|
|
|
|
.attr('data-text', 'matchHere')
|
|
|
|
.attr('data-text-class', 'text-xs center')
|
|
|
|
} else {
|
|
|
|
// Separate match line and inner fold line.
|
|
|
|
paths.placketMatch = new Path()
|
|
|
|
.move(points.placketBottomMatch)
|
|
|
|
.line(points.placketTopMatch)
|
|
|
|
.attr('class', 'stroke-sm help')
|
|
|
|
.attr('data-text', 'matchHere')
|
|
|
|
.attr('data-text-class', 'text-xs center')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('sprinkle', {
|
|
|
|
snippet: 'notch',
|
2018-12-22 17:30:12 +01:00
|
|
|
on: [
|
2019-08-03 15:03:33 +02:00
|
|
|
'cfNeck',
|
2021-04-24 10:16:31 +02:00
|
|
|
'cfHem',
|
|
|
|
],
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
// Buttons
|
2019-08-03 15:03:33 +02:00
|
|
|
addButtons(part)
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
// Title
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('title', { at: points.title, nr: 1, title: 'frontRight' })
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
if (sa) {
|
|
|
|
paths.saFromArmhole
|
|
|
|
.line(new Point(points.placketTopEdge.x, points.placketTopEdge.y - sa))
|
|
|
|
.line(points.placketTopEdge)
|
|
|
|
.move(points.placketBottomEdge)
|
|
|
|
.line(points.placketBottomEdge.shift(-90, sa * 3))
|
2019-08-03 15:03:33 +02:00
|
|
|
.line(paths.hemSa.start())
|
2018-12-22 17:30:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2021-04-20 19:30:17 +02:00
|
|
|
macro('hd', {
|
|
|
|
from: points.hps,
|
|
|
|
to: points.placketTopEdge,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.hps.y - sa - 15,
|
2021-04-20 19:30:17 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2021-06-19 12:50:46 +02:00
|
|
|
from: points.s3ArmholeSplit,
|
2021-04-20 19:30:17 +02:00
|
|
|
to: points.placketTopEdge,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.hps.y - sa - 30,
|
2021-04-20 19:30:17 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
|
|
|
from: points.armhole,
|
|
|
|
to: points.placketTopEdge,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.hps.y - sa - 45,
|
2021-04-20 19:30:17 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
|
|
|
from: points.placketTopEdge,
|
2021-06-19 12:50:46 +02:00
|
|
|
to: points.s3CollarSplit,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.placketTopEdge.x + sa + 15,
|
2021-04-20 19:30:17 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
|
|
|
from: points.placketBottomEdge,
|
|
|
|
to: points.placketTopEdge,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.placketTopEdge.x + sa + 15,
|
2021-04-20 19:30:17 +02:00
|
|
|
})
|
2018-12-22 17:30:12 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
|
|
|
}
|