sparkles: Properly formatted title
This commit is contained in:
parent
ddc8775275
commit
83aaa56bdf
10 changed files with 2694 additions and 4101 deletions
|
@ -1,26 +1,30 @@
|
|||
import style from './lib/style';
|
||||
const VERSION = require('../package.json').version;
|
||||
import style from "./lib/style";
|
||||
import { version } from "../package.json";
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
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.attributes.add("freesewing:plugin-title", version);
|
||||
this.style += style;
|
||||
next();
|
||||
}
|
||||
}
|
||||
, macros: {
|
||||
},
|
||||
macros: {
|
||||
title: function(next, so) {
|
||||
so.at.attr('data-text', so.nr).attr('data-text-class', 'title-nr');
|
||||
this.points.titleName = so.at.shift(-90, 20)
|
||||
.attr('data-text', title)
|
||||
.attr('data-text-class', 'title-name');
|
||||
this.points.titlePattern = so.at.shift(-90, 40)
|
||||
.attr('data-text', pattern)
|
||||
.attr('data-text-class', 'title-pattern');
|
||||
console.log("in plugin, so", so, this);
|
||||
so.at.attr("data-text", so.nr).attr("data-text-class", "title-nr note");
|
||||
this.points.titleName = so.at
|
||||
.shift(-90, 13)
|
||||
.attr("data-text", so.title || this.id)
|
||||
.attr("data-text-class", "title-name");
|
||||
this.points.titlePattern = so.at
|
||||
.shift(-90, 20)
|
||||
.attr(
|
||||
"data-text",
|
||||
this.context.config.name + " v" + this.context.config.version
|
||||
)
|
||||
.attr("data-text-class", "title-pattern fill-note");
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = `
|
||||
<marker orient="auto" refY="0.0" refX="0.0" id="cutonfoldFrom" style="overflow:visible;" >
|
||||
<path style="stroke: #ff5b77; fill: #ff5b77;" d="M 0,0 L 12,-4 C 10,-2 10,2 12, 4 z" />
|
||||
</marker>
|
||||
<marker orient="auto" refY="0.0" refX="0.0" id="cutonfoldTo" style="overflow:visible;" >
|
||||
<path style="stroke: #ff5b77; fill: #ff5b77;" d="M 0,0 L -12,-4 C -10,-2 -10,2 -12, 4 z" />
|
||||
</marker>
|
||||
`;
|
20
packages/plugin-title/src/lib/style.css
Normal file
20
packages/plugin-title/src/lib/style.css
Normal file
|
@ -0,0 +1,20 @@
|
|||
text.title-nr {
|
||||
font-size: 24pt;
|
||||
font-weight: 700;
|
||||
fill: none;
|
||||
text-anchor: middle;
|
||||
dominant-baseline: reset-size;
|
||||
}
|
||||
text.title-name {
|
||||
font-size: 7pt;
|
||||
font-weight: 500;
|
||||
text-anchor: middle;
|
||||
dominant-baseline: reset-size;
|
||||
}
|
||||
text.title-pattern {
|
||||
font-size: 4pt;
|
||||
font-weight: 500;
|
||||
dominant-baseline: reset-size;
|
||||
text-anchor: middle;
|
||||
font-style: italic;
|
||||
}
|
|
@ -1,5 +1 @@
|
|||
module.exports = `
|
||||
text.title-nr{ font-size: 24; }
|
||||
text.title-name{ font-size: 16; }
|
||||
text.title-pattern{ font-size: 6; }
|
||||
`;
|
||||
export default `text.title-nr{font-size:24pt;font-weight:700;fill:none;text-anchor:middle;dominant-baseline:reset-size}text.title-name{font-size:7pt;font-weight:500;text-anchor:middle;dominant-baseline:reset-size}text.title-pattern{font-size:4pt;font-weight:500;dominant-baseline:reset-size;text-anchor:middle;font-style:italic}`;
|
||||
|
|
1
packages/plugin-title/src/lib/style.min.css
vendored
Normal file
1
packages/plugin-title/src/lib/style.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
text.title-nr{font-size:24pt;font-weight:700;fill:none;text-anchor:middle;dominant-baseline:reset-size}text.title-name{font-size:7pt;font-weight:500;text-anchor:middle;dominant-baseline:reset-size}text.title-pattern{font-size:4pt;font-weight:500;dominant-baseline:reset-size;text-anchor:middle;font-style:italic}
|
Loading…
Add table
Add a link
Reference in a new issue