1
0
Fork 0
freesewing/packages/plugin-banner/src/index.js

21 lines
643 B
JavaScript
Raw Normal View History

2019-08-03 15:03:33 +02:00
import { name, version } from '../package.json'
2018-12-28 15:08:20 +01:00
export default {
name: name,
version: version,
hooks: {
preRender: (svg) => svg.attributes.setIfUnset('freesewing:plugin-banner', version),
2018-12-28 15:08:20 +01:00
},
macros: {
2021-01-31 09:22:15 +01:00
banner: function (so) {
2019-08-03 15:03:33 +02:00
let defaults = { text: [], dy: -1, spaces: 8, repeat: 25 }
so = { ...defaults, ...so }
this.paths[so.path].attr('data-text-dy', so.dy).attr('data-text-class', 'center')
for (let i = 0; i < so.repeat; i++) {
for (let t of so.text) this.paths[so.path].attr('data-text', t)
this.paths[so.path].attr('data-text', '&#160;'.repeat(so.spaces))
2018-12-28 15:08:20 +01:00
}
2021-04-24 10:16:31 +02:00
},
},
2019-08-03 15:03:33 +02:00
}