1
0
Fork 0
freesewing/designs/sven/src/shared.mjs

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-09-11 16:59:37 +02:00
export const draftRibbing = function (
2023-09-18 20:14:55 +02:00
{ store, measurements, options, points, paths, Path, Point, sa, macro, units, part },
2022-09-11 16:59:37 +02:00
length
) {
2023-09-18 20:14:55 +02:00
const height = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight
if (part.context.settings.sample) store.set('ribbingHeight', height)
else store.setIfUnset('ribbingHeight', height)
2019-08-03 15:03:33 +02:00
points.topLeft = new Point(0, 0)
points.topRight = new Point(height * 2, 0)
2023-09-18 20:14:55 +02:00
points.bottomLeft = new Point(0, length)
points.bottomRight = new Point(height * 2, length)
2019-01-03 15:19:50 +01:00
paths.seam = new Path()
2023-09-18 20:14:55 +02:00
.move(points.topLeft)
2019-01-03 15:19:50 +01:00
.line(points.bottomLeft)
.line(points.bottomRight)
2023-09-18 20:14:55 +02:00
.line(points.topRight)
.line(points.topLeft)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'various')
2023-09-18 20:14:55 +02:00
if (sa) paths.sa = paths.seam.offset(sa).addClass('various sa')
2019-01-03 15:19:50 +01:00
2023-09-18 20:14:55 +02:00
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
2019-01-03 15:19:50 +01:00
2023-09-18 20:14:55 +02:00
macro('vd', {
from: points.bottomRight,
to: points.topRight,
x: points.topRight.x + sa + 15,
text: units(length),
})
macro('hd', {
from: points.topLeft,
to: points.topRight,
y: points.topRight.y - sa - 15,
})
2019-08-03 15:03:33 +02:00
}