chore(plugin-bartack): Using new attributes.setIfUnset() method
This commit is contained in:
parent
87cfedd2ab
commit
a9879aeda1
2 changed files with 5 additions and 9 deletions
|
@ -2,7 +2,7 @@ const name = (n, so) => `${so.prefix}${n}${so.suffix}`
|
||||||
|
|
||||||
const drawBartack = (points, self) => {
|
const drawBartack = (points, self) => {
|
||||||
let path = new self.Path().move(points.path1[0])
|
let path = new self.Path().move(points.path1[0])
|
||||||
for (let i in points.path1) {
|
for (const i in points.path1) {
|
||||||
if (points.path1[i]) path = path.line(points.path1[i])
|
if (points.path1[i]) path = path.line(points.path1[i])
|
||||||
if (points.path2[i]) path = path.line(points.path2[i])
|
if (points.path2[i]) path = path.line(points.path2[i])
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,24 +5,20 @@ export default {
|
||||||
name: name,
|
name: name,
|
||||||
version: version,
|
version: version,
|
||||||
hooks: {
|
hooks: {
|
||||||
preRender: function (svg) {
|
preRender: svg => svg.attributes.setIfUnset('freesewing:plugin-bartack', version)
|
||||||
if (svg.attributes.get('freesewing:plugin-bartack') === false) {
|
|
||||||
svg.attributes.set('freesewing:plugin-bartack', version)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
macros: {
|
macros: {
|
||||||
bartack: function (so) {
|
bartack: function (so) {
|
||||||
let self = this
|
const self = this
|
||||||
return bartack(so, self)
|
return bartack(so, self)
|
||||||
},
|
},
|
||||||
bartackAlong: function (so) {
|
bartackAlong: function (so) {
|
||||||
let self = this
|
const self = this
|
||||||
so.bartackAlong = true
|
so.bartackAlong = true
|
||||||
return bartack(so, self)
|
return bartack(so, self)
|
||||||
},
|
},
|
||||||
bartackFractionAlong: function (so) {
|
bartackFractionAlong: function (so) {
|
||||||
let self = this
|
const self = this
|
||||||
so.bartackFractionAlong = true
|
so.bartackFractionAlong = true
|
||||||
return bartack(so, self)
|
return bartack(so, self)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue