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

56 lines
1.7 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 { Point, Path, points, paths, snippets, Snippet, 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')
2019-05-07 12:50:49 +02:00
2021-12-24 13:28:34 +01:00
const snips = {
logo: 75,
2019-05-07 12:50:49 +02:00
notch: 15,
bnotch: 15,
button: 15,
2021-12-24 13:28:34 +01:00
buttonhole: 25,
"buttonhole-start": 15,
"buttonhole-end": 25,
"snap-socket": 25,
"snap-stud": 15,
2019-08-03 15:03:33 +02:00
}
2021-12-24 13:28:34 +01:00
y += 20
points.snippets = new Point(0,y)
.attr('data-text', 'Snippets')
.attr('data-text-class', 'text-lg bold')
2019-08-03 15:03:33 +02:00
y += 10
points['sl1'] = new Point(w * 0.25, y)
points['sl2'] = new Point(w * 0.5, y)
points['sl3'] = new Point(w * 0.75, y)
points['sl1']
.attr('data-text', 'data-scale: 1\ndata-rotate: 0')
2021-12-24 13:28:34 +01:00
.attr('data-text-class', 'center text')
.attr('data-text-lineheight', 7)
2019-08-03 15:03:33 +02:00
points['sl2']
.attr('data-text', 'data-scale: 1.25\ndata-rotate: 0')
2021-12-24 13:28:34 +01:00
.attr('data-text-class', 'center text')
.attr('data-text-lineheight', 7)
2019-08-03 15:03:33 +02:00
points['sl3']
.attr('data-text', 'data-scale: 0.75\ndata-rotate: 90')
2021-12-24 13:28:34 +01:00
.attr('data-text-class', 'center text')
.attr('data-text-lineheight', 7)
2019-08-03 15:03:33 +02:00
y += 55
2019-05-07 12:50:49 +02:00
for (let i in snips) {
2019-08-03 15:03:33 +02:00
points['snt' + i] = new Point(0, y)
points['snt' + i].attr('data-text', i)
2021-12-24 13:28:34 +01:00
points['sn1' + i] = new Point(w * 0.3, y)
points['sn2' + i] = new Point(w * 0.55, y)
points['sn3' + i] = new Point(w * 0.8, y)
2019-08-03 15:03:33 +02:00
snippets['sn1' + i] = new Snippet(i, points['sn1' + i])
snippets['sn2' + i] = new Snippet(i, points['sn2' + i])
snippets['sn2' + i].attr('data-scale', 1.25)
snippets['sn3' + i] = new Snippet(i, points['sn3' + i])
snippets['sn3' + i].attr('data-scale', 0.75).attr('data-rotate', 90)
y += snips[i]
2019-05-07 12:50:49 +02:00
}
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
}