1
0
Fork 0
freesewing/packages/rendertest/src/macros.js

66 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-01-31 09:22:15 +01:00
export default function (part) {
2019-08-03 15:03:33 +02:00
let { macro, Point, Path, points, paths, store } = part.shorthand()
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
let y = store.get('y')
let w = store.get('w')
y += 10
points.ml = new Point(0, y)
points.mr = new Point(w, y)
2021-01-31 09:22:15 +01:00
paths.macros = new Path().move(points.ml).line(points.mr).attr('data-text', 'macros')
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
y += 40
macro('title', {
2019-05-07 12:50:49 +02:00
at: new Point(w / 2, y),
nr: 5,
2021-04-24 10:16:31 +02:00
title: 'title',
2019-08-03 15:03:33 +02:00
})
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
y += 40
macro('grainline', {
2019-05-07 12:50:49 +02:00
from: new Point(0, y),
2021-04-24 10:16:31 +02:00
to: new Point(w, y),
2019-08-03 15:03:33 +02:00
})
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
y += 20
macro('cutonfold', {
2019-05-07 12:50:49 +02:00
from: new Point(w, y),
2021-04-24 10:16:31 +02:00
to: new Point(0, y),
2019-08-03 15:03:33 +02:00
})
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
y += 70
points.dimf = new Point(20, y)
points.dimt = new Point(w - 20, y + 120)
points.dimv = new Point(20, y + 80)
paths.dims = new Path().move(points.dimf)._curve(points.dimv, points.dimt)
macro('hd', {
2019-05-07 12:50:49 +02:00
from: points.dimf,
to: points.dimt,
2019-08-03 15:03:33 +02:00
text: 'hd',
2021-04-24 10:16:31 +02:00
y: y - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-05-07 12:50:49 +02:00
from: points.dimt,
to: points.dimf,
2019-08-03 15:03:33 +02:00
text: 'vd',
2021-04-24 10:16:31 +02:00
x: 0,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-05-07 12:50:49 +02:00
from: points.dimf,
to: points.dimt,
2021-04-24 10:16:31 +02:00
text: 'ld',
2019-08-03 15:03:33 +02:00
})
macro('pd', {
2019-05-07 12:50:49 +02:00
path: paths.dims,
2019-08-03 15:03:33 +02:00
text: 'pd',
2021-04-24 10:16:31 +02:00
d: 10,
2019-08-03 15:03:33 +02:00
})
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
y += 170
macro('scalebox', {
2021-04-24 10:16:31 +02:00
at: new Point(w / 2, y),
2019-08-03 15:03:33 +02:00
})
store.set('y', y)
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
return part
2019-05-07 12:50:49 +02:00
}