Merge pull request #2504 from freesewing/plugin-cutonfold
feat(plugin-cutonfold): Set part cutonfold/grain in macro
This commit is contained in:
commit
cad54084e6
1 changed files with 25 additions and 20 deletions
|
@ -14,21 +14,25 @@ export default {
|
||||||
},
|
},
|
||||||
macros: {
|
macros: {
|
||||||
cutonfold: function (so) {
|
cutonfold: function (so) {
|
||||||
|
const { points, complete } = this.shorthand()
|
||||||
if (so === false) {
|
if (so === false) {
|
||||||
delete this.points.cutonfoldFrom
|
delete this.points.cutonfoldFrom
|
||||||
delete this.points.cutonfoldTo
|
delete this.points.cutonfoldTo
|
||||||
delete this.points.cutonfoldVia1
|
delete this.points.cutonfoldVia1
|
||||||
delete this.points.cutonfoldVia2
|
delete this.points.cutonfoldVia2
|
||||||
delete this.paths.cutonfold
|
delete this.paths.cutonfold
|
||||||
|
this.setCutOnFold(false) // Restore default
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const points = this.points
|
|
||||||
so = {
|
so = {
|
||||||
offset: 15,
|
offset: 15,
|
||||||
margin: 5,
|
margin: 5,
|
||||||
prefix: '',
|
prefix: '',
|
||||||
...so,
|
...so,
|
||||||
}
|
}
|
||||||
|
this.setCutOnFold(so.from, so.to)
|
||||||
|
if (so.grainline) this.setGrain(so.from.angle(so.to))
|
||||||
|
if (complete) {
|
||||||
points['cutonfoldFrom' + so.prefix] = so.from.shiftFractionTowards(so.to, so.margin / 100)
|
points['cutonfoldFrom' + so.prefix] = so.from.shiftFractionTowards(so.to, so.margin / 100)
|
||||||
points['cutonfoldTo' + so.prefix] = so.to.shiftFractionTowards(so.from, so.margin / 100)
|
points['cutonfoldTo' + so.prefix] = so.to.shiftFractionTowards(so.from, so.margin / 100)
|
||||||
points['cutonfoldVia1' + so.prefix] = points['cutonfoldFrom' + so.prefix]
|
points['cutonfoldVia1' + so.prefix] = points['cutonfoldFrom' + so.prefix]
|
||||||
|
@ -48,6 +52,7 @@ export default {
|
||||||
.attr('marker-end', 'url(#cutonfoldTo)')
|
.attr('marker-end', 'url(#cutonfoldTo)')
|
||||||
.attr('data-text', text)
|
.attr('data-text', text)
|
||||||
.attr('data-text-class', 'center fill-note')
|
.attr('data-text-class', 'center fill-note')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue