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) => {
|
2021-09-12 15:29:59 +02:00
|
|
|
const {
|
2018-12-27 15:04:32 +01:00
|
|
|
utils,
|
|
|
|
sa,
|
|
|
|
Point,
|
|
|
|
points,
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
Snippet,
|
|
|
|
snippets,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
macro,
|
2021-04-24 10:16:31 +02:00
|
|
|
options,
|
2021-11-01 18:15:47 +01:00
|
|
|
store,
|
2019-08-03 15:03:33 +02:00
|
|
|
} = part.shorthand()
|
2018-12-22 17:30:12 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
if (!options.seperateButtonPlacket || options.buttonPlacketStyle !== 'classic') {
|
|
|
|
part.paths = {}
|
|
|
|
part.snippets = {}
|
|
|
|
part.points = {}
|
|
|
|
return part
|
2018-12-23 14:54:34 +01:00
|
|
|
}
|
|
|
|
|
2021-09-12 15:29:59 +02:00
|
|
|
for (const id in paths) {
|
2019-08-03 15:03:33 +02:00
|
|
|
if (id !== 'seam') delete part.paths[id]
|
2018-12-22 17:30:12 +01:00
|
|
|
}
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('flip')
|
2021-09-12 15:29:59 +02:00
|
|
|
const width = store.get('buttonPlacketWidth')
|
2018-12-22 17:30:12 +01:00
|
|
|
points.placketTopIn = utils.lineIntersectsCurve(
|
|
|
|
new Point(width / -2, points.cfNeck.y + 20),
|
|
|
|
new Point(width / -2, points.cfNeck.y - 20),
|
|
|
|
points.cfNeck,
|
|
|
|
points.cfNeckCp1,
|
|
|
|
points.neckCp2Front,
|
|
|
|
points.neck
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
|
|
|
points.placketTopOut = points.cfNeck.shift(0, width / 2)
|
|
|
|
points.placketTopEdge = points.cfNeck.shift(0, width * 1.5)
|
|
|
|
points.placketBottomIn = points.cfHem.shift(180, width / 2)
|
|
|
|
points.placketBottomOut = points.cfHem.shift(0, width / 2)
|
|
|
|
points.placketBottomEdge = points.cfHem.shift(0, width * 1.5)
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
paths.saBase = new Path()
|
|
|
|
.move(points.placketBottomIn)
|
|
|
|
.line(points.placketTopIn)
|
|
|
|
.join(paths.seam.split(points.placketTopIn)[1])
|
|
|
|
.line(points.placketTopEdge)
|
2019-08-03 15:03:33 +02:00
|
|
|
.line(points.placketBottomEdge)
|
2018-12-22 17:30:12 +01:00
|
|
|
|
2021-01-31 09:22:15 +01:00
|
|
|
paths.seam = paths.saBase.clone().close().attr('class', 'fabric')
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
|
|
|
// Placket help lines
|
|
|
|
paths.placketOuterFold = new Path()
|
|
|
|
.move(points.placketTopOut)
|
|
|
|
.line(points.placketBottomOut)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'dotted')
|
|
|
|
macro('sprinkle', {
|
|
|
|
snippet: 'notch',
|
2021-04-24 10:16:31 +02:00
|
|
|
on: ['placketTopOut', 'placketBottomOut'],
|
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
|
|
|
|
|
|
|
// Grainline
|
2019-08-03 15:03:33 +02:00
|
|
|
points.grainlineFrom = points.placketBottomEdge.shift(180, width / 2)
|
|
|
|
points.grainlineTo = points.placketTopEdge.shift(180, width / 2)
|
|
|
|
macro('grainline', {
|
2018-12-22 17:30:12 +01:00
|
|
|
from: points.grainlineFrom,
|
2021-04-24 10:16:31 +02:00
|
|
|
to: points.grainlineTo,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
// Title
|
2019-08-03 15:03:33 +02:00
|
|
|
points.title = new Point(points.placketTopOut.x, points.cfArmhole.y)
|
|
|
|
macro('title', {
|
2018-12-22 17:30:12 +01:00
|
|
|
at: points.title,
|
2019-08-03 15:03:33 +02:00
|
|
|
nr: '1b',
|
|
|
|
title: 'buttonPlacket',
|
2018-12-22 17:30:12 +01:00
|
|
|
scale: 0.75,
|
2021-04-24 10:16:31 +02:00
|
|
|
rotation: -90,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
// Logo
|
2019-08-03 15:03:33 +02:00
|
|
|
points.logo = points.title.shift(-90, 120)
|
|
|
|
snippets.logo = new Snippet('logo', points.logo)
|
|
|
|
.attr('data-scale', 0.5)
|
|
|
|
.attr('data-rotate', -90)
|
2018-12-22 17:30:12 +01:00
|
|
|
|
|
|
|
if (sa) {
|
|
|
|
paths.sa = paths.saBase
|
|
|
|
.offset(sa * -1)
|
2019-08-03 15:03:33 +02:00
|
|
|
.line(new Point(points.placketBottomEdge.x + sa, points.placketBottomEdge.y + 3 * sa))
|
|
|
|
.line(new Point(points.placketBottomIn.x - sa, points.placketBottomIn.y + 3 * sa))
|
2018-12-22 17:30:12 +01:00
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric sa')
|
2018-12-22 17:30:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2018-12-28 16:57:08 +01:00
|
|
|
from: points.placketTopIn,
|
|
|
|
to: points.placketTopOut,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.placketTopIn.y - 15 - sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2018-12-28 16:57:08 +01:00
|
|
|
from: points.placketTopIn,
|
|
|
|
to: points.placketTopEdge,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.placketTopIn.y - 30 - sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2018-12-28 16:57:08 +01:00
|
|
|
from: points.placketBottomEdge,
|
|
|
|
to: points.placketTopEdge,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.placketTopEdge.x + 15 + sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
points.button0 = points.placketTopEdge
|
|
|
|
let j
|
2018-12-28 16:57:08 +01:00
|
|
|
for (let i = 0; i < options.buttons; i++) {
|
2019-08-03 15:03:33 +02:00
|
|
|
j = i + 1
|
|
|
|
macro('vd', {
|
|
|
|
from: points['button' + j],
|
|
|
|
to: points['button' + i],
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.placketTopIn.x - 15 - sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2018-12-28 16:57:08 +01:00
|
|
|
}
|
2018-12-22 17:30:12 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
|
|
|
}
|