2018-12-28 15:08:20 +01:00
|
|
|
import { name, version } from "../package.json";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: name,
|
|
|
|
version: version,
|
|
|
|
hooks: {
|
|
|
|
preRender: function(svg) {
|
|
|
|
if (svg.attributes.get("freesewing:plugin-banner") === false)
|
|
|
|
svg.attributes.set("freesewing:plugin-banner", version);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
macros: {
|
2018-12-28 15:40:46 +01:00
|
|
|
banner: function(so) {
|
2018-12-28 15:08:20 +01:00
|
|
|
let defaults = { text: [], dy: -1, spaces: 8, repeat: 25 };
|
|
|
|
so = { ...defaults, ...so };
|
2018-12-28 15:40:46 +01:00
|
|
|
this.paths[so.path]
|
2018-12-28 15:08:20 +01:00
|
|
|
.attr("data-text-dy", so.dy)
|
|
|
|
.attr("data-text-class", "center");
|
|
|
|
for(let i=0; i<so.repeat;i++) {
|
2018-12-28 15:40:46 +01:00
|
|
|
for(let t of so.text) this.paths[so.path].attr("data-text", t);
|
2019-04-13 15:10:32 +02:00
|
|
|
this.paths[so.path].attr("data-text", " ".repeat(so.spaces));
|
2018-12-28 15:08:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|