1
0
Fork 0
freesewing/packages/simon/src/sleeveplacket-underlap.js

103 lines
2.5 KiB
JavaScript
Raw Normal View History

2021-01-31 09:22:15 +01:00
export default (part) => {
const {
2018-12-27 14:36:52 +01:00
measurements,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
complete,
paperless,
macro,
2021-04-24 10:16:31 +02:00
options,
2021-09-28 19:28:23 +02:00
store,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2018-12-24 17:35:06 +01:00
const width = store.get('sleevePlacketWidth') > 20 ? 10 : store.get('sleevePlacketWidth') / 4
const length = measurements.shoulderToWrist * options.sleevePlacketLength
2018-12-24 17:35:06 +01:00
2019-08-03 15:03:33 +02:00
points.midLeft = new Point(0, 0)
points.midRight = points.midLeft.shift(0, length)
points.fold1Left = points.midLeft.shift(90, width)
points.fold2Left = points.midLeft.shift(-90, width)
points.fold1Right = points.fold1Left.shift(0, length)
points.fold2Right = points.fold2Left.shift(0, length)
points.topLeft = points.midLeft.shift(90, width * 2 - 1.5)
points.topRight = points.midRight.shift(90, width * 2 - 1.5)
points.bottomLeft = points.midLeft.shift(-90, width * 2 - 1.5)
points.bottomRight = points.midRight.shift(-90, width * 2 - 1.5)
2018-12-24 17:35:06 +01:00
paths.seam = new Path()
.move(points.topLeft)
.line(points.topRight)
.line(points.bottomRight)
.line(points.bottomLeft)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2018-12-24 17:35:06 +01:00
paths.folds = new Path()
.move(points.fold1Left)
.line(points.fold1Right)
.move(points.fold2Left)
.line(points.fold2Right)
.move(points.midLeft)
.line(points.midRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'help')
2018-12-24 17:35:06 +01:00
// Complete pattern?
if (complete) {
// Title
2019-08-03 15:03:33 +02:00
points.title = new Point(length / 4, 0)
macro('title', {
2018-12-24 17:35:06 +01:00
at: points.title,
nr: 9,
2019-08-03 15:03:33 +02:00
title: 'sleevePlacketUnderlap',
2018-12-24 17:35:06 +01:00
scale: 0.6,
2021-04-24 10:16:31 +02:00
append: true,
2019-08-03 15:03:33 +02:00
})
2018-12-24 17:35:06 +01:00
// Button
2019-08-03 15:03:33 +02:00
points.button = new Point(length / 2, width / 2)
snippets.button = new Snippet('button', points.button)
2018-12-24 17:35:06 +01:00
if (sa) {
paths.sa = new Path()
.move(points.bottomLeft)
.line(points.bottomLeft.shift(180, sa))
.line(points.topLeft.shift(180, sa))
.line(points.topLeft)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric sa')
2018-12-24 17:35:06 +01:00
}
}
// Paperless?
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('vd', {
2018-12-27 14:16:28 +01:00
from: points.fold2Right,
to: points.fold1Right,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2018-12-27 14:16:28 +01:00
from: points.bottomRight,
to: points.topRight,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + 30,
2019-08-03 15:03:33 +02:00
})
if (complete) {
macro('hd', {
from: points.bottomLeft,
to: points.button,
y: points.bottomRight.y + 15,
})
}
2019-08-03 15:03:33 +02:00
macro('hd', {
2018-12-27 14:16:28 +01:00
from: points.bottomLeft,
to: points.bottomRight,
2021-04-24 10:16:31 +02:00
y: points.bottomRight.y + 30,
2019-08-03 15:03:33 +02:00
})
2018-12-24 17:35:06 +01:00
}
2019-08-03 15:03:33 +02:00
return part
}