1
0
Fork 0
freesewing/packages/examples/src/plugin_dimension.js

50 lines
871 B
JavaScript
Raw Normal View History

2021-01-31 09:22:15 +01:00
export default (part) => {
2019-08-03 15:03:33 +02:00
let { Point, points, Path, paths, macro } = part.shorthand()
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
points.A = new Point(0, 0)
points.B = new Point(0, 100)
points.C = new Point(50, 100)
points.D = new Point(100, 50)
points.DCp1 = new Point(100, 0)
2019-01-27 12:54:18 +01:00
paths.box = new Path()
.move(points.A)
.line(points.B)
.line(points.C)
.line(points.D)
.curve(points.DCp1, points.A, points.A)
2019-08-03 15:03:33 +02:00
.close()
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
macro('vd', {
2019-01-27 12:54:18 +01:00
from: points.A,
to: points.B,
x: points.A.x - 15
2019-08-03 15:03:33 +02:00
})
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
macro('hd', {
2019-01-27 12:54:18 +01:00
from: points.B,
to: points.C,
y: points.B.y + 15
2019-08-03 15:03:33 +02:00
})
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
macro('ld', {
2019-01-27 12:54:18 +01:00
from: points.C,
to: points.D,
d: -15
2019-08-03 15:03:33 +02:00
})
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
macro('ld', {
2019-01-27 12:54:18 +01:00
from: points.C,
to: points.D,
d: -30,
2019-08-03 15:03:33 +02:00
text: 'Custom text'
})
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
macro('pd', {
2019-01-27 12:54:18 +01:00
path: new Path().move(points.A).curve(points.A, points.DCp1, points.D),
d: -15
2019-08-03 15:03:33 +02:00
})
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
return part
}