tada: First commit
This commit is contained in:
parent
3d82690400
commit
6efda92f63
11 changed files with 6455 additions and 3 deletions
28
packages/plugin-title/src/index.js
Normal file
28
packages/plugin-title/src/index.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
import style from './lib/style';
|
||||
const VERSION = require('../package.json').version;
|
||||
|
||||
module.exports = {
|
||||
hooks: {
|
||||
preRenderSvg: function(next) {
|
||||
// Without this, our custom attribute won't be valid
|
||||
this.attributes.add("xmlns:freesewing-plugins", "http://freesewing.org/namespaces/freesewing-plugins");
|
||||
this.attributes.add("freesewing-plugins:macro-title", VERSION);
|
||||
this.style += style;
|
||||
next();
|
||||
}
|
||||
}
|
||||
, macros: {
|
||||
title: function(next, so) {
|
||||
let points = this.points;
|
||||
so.at.attr('data-text', so.nr)
|
||||
.attr('data-text-class', 'title-nr');
|
||||
points.titleName = so.at.shift(-90, 20)
|
||||
.attr('data-text', title)
|
||||
.attr('data-text-class', 'title-name');
|
||||
points.titlePattern = so.at.shift(-90, 40)
|
||||
.attr('data-text', pattern)
|
||||
.attr('data-text-class', 'title-pattern');
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue