2018-07-24 11:38:46 +00:00
|
|
|
import meta from "../package.json";
|
2018-07-21 16:37:18 +02:00
|
|
|
|
2018-07-23 17:44:52 +00:00
|
|
|
export default {
|
2018-07-21 15:34:46 +02:00
|
|
|
hooks: {
|
|
|
|
preRenderSvg: function(next) {
|
2018-07-24 11:38:46 +00:00
|
|
|
this.attributes.add("freesewing:plugin-cutonfold", meta.version);
|
2018-07-21 15:34:46 +02:00
|
|
|
next();
|
|
|
|
}
|
2018-07-24 09:10:09 +00:00
|
|
|
},
|
|
|
|
macros: {
|
2018-07-21 16:40:26 +02:00
|
|
|
cutonfold: function(next, so) {
|
2018-07-21 15:34:46 +02:00
|
|
|
let points = this.points;
|
|
|
|
points.cofStart = so.from.shiftTowards(so.to, 30);
|
|
|
|
points.cofEnd = so.to.shiftTowards(so.from, 30);
|
2018-07-24 09:10:09 +00:00
|
|
|
points.cofVia1 = so.from
|
|
|
|
.shiftTowards(so.to, 50)
|
|
|
|
.rotate(90, points.cofStart);
|
|
|
|
points.cofVia2 = so.to
|
|
|
|
.shiftTowards(so.from, 50)
|
|
|
|
.rotate(-90, points.cofEnd);
|
2018-07-21 15:34:46 +02:00
|
|
|
this.paths.cof = new this.path()
|
|
|
|
.move(points.cofStart)
|
|
|
|
.line(points.cofVia1)
|
|
|
|
.line(points.cofVia2)
|
|
|
|
.line(points.cofEnd)
|
2018-07-24 09:10:09 +00:00
|
|
|
.attr("class", "cut-on-fold");
|
2018-07-21 15:34:46 +02:00
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
2018-07-24 09:10:09 +00:00
|
|
|
};
|