construction: Working cutonfold macro
This commit is contained in:
parent
4d949cd56e
commit
7f1bca7ed5
10 changed files with 26 additions and 483 deletions
|
@ -23,59 +23,12 @@
|
|||
shoulderToWrist: 700,
|
||||
wristCircumference: 190
|
||||
};
|
||||
pattern.settings.paperless = true;
|
||||
//pattern.on('preRenderSvg', function(next) {
|
||||
// this.attributes.add("viewBox", "-10 -10 600 800");
|
||||
// next();
|
||||
//});
|
||||
var macroPlugin = {
|
||||
hooks: {
|
||||
preRenderSvg: function(next) {
|
||||
console.log('in mixed plugin hooks part');
|
||||
this.attributes.add("viewBox", "-12 -12 600 800");
|
||||
next();
|
||||
}
|
||||
}
|
||||
, macros: {
|
||||
cof: function(next, so) {
|
||||
console.log('in mixed plugin macros part');
|
||||
let points = this.points;
|
||||
points.cofStart = so.from.shiftTowards(so.to, 30);
|
||||
points.cofEnd = so.to.shiftTowards(so.from, 30);
|
||||
points.cofVia1 = so.from.shiftTowards(so.to, 50).rotate(90,points.cofStart);
|
||||
points.cofVia2 = so.to.shiftTowards(so.from, 50).rotate(-90,points.cofEnd);
|
||||
this.paths.cof = new this.path()
|
||||
.move(points.cofStart)
|
||||
.line(points.cofVia1)
|
||||
.line(points.cofVia2)
|
||||
.line(points.cofEnd)
|
||||
.attr('class', 'cut-on-fold');
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
//pattern.macro('cof', function(next, so) {
|
||||
// let points = this.points;
|
||||
// points.cofStart = so.from.shiftTowards(so.to, 30);
|
||||
// points.cofEnd = so.to.shiftTowards(so.from, 30);
|
||||
// points.cofVia1 = so.from.shiftTowards(so.to, 50).rotate(90,points.cofStart);
|
||||
// points.cofVia2 = so.to.shiftTowards(so.from, 50).rotate(-90,points.cofEnd);
|
||||
// this.paths.cof = new this.path()
|
||||
// .move(points.cofStart)
|
||||
// .line(points.cofVia1)
|
||||
// .line(points.cofVia2)
|
||||
// .line(points.cofEnd)
|
||||
// .attr('class', 'cut-on-fold');
|
||||
// next();
|
||||
//});
|
||||
//pattern.on('postRenderSvg', function(next) {
|
||||
// this.svg = this.svg.replace('green', 'yellow');
|
||||
// next();
|
||||
//});
|
||||
//console.log(freesewing_theme_default);
|
||||
pattern.withPlugin(freesewing_theme_designer);
|
||||
pattern.withPlugin(freesewing_theme_default);
|
||||
pattern.withPlugin(macroPlugin);
|
||||
pattern.on('preRenderSvg', function(next) {
|
||||
this.attributes.add('viewBox', '-10 -10 400 600');
|
||||
next();
|
||||
});
|
||||
pattern.draft();
|
||||
document.getElementById("svg").innerHTML = pattern.render();
|
||||
function pointHover(evt) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue