1
0
Fork 0

🎨 Updated prettier config

This commit is contained in:
Joost De Cock 2019-08-03 15:03:33 +02:00
parent b8e632998b
commit 6710d76b08
401 changed files with 13193 additions and 15620 deletions

View file

@ -1,42 +1,39 @@
import { name, version } from "../package.json";
import { name, version } from '../package.json'
export default {
name: name,
version: version,
hooks: {
preRender: function(svg) {
if (svg.attributes.get("freesewing:plugin-flip") === false)
svg.attributes.set("freesewing:plugin-flip", version);
if (svg.attributes.get('freesewing:plugin-flip') === false)
svg.attributes.set('freesewing:plugin-flip', version)
}
},
macros: {
flip: function() {
let flipped = null;
let ops = ["from", "to", "cp1", "cp2"];
let flipped = null
let ops = ['from', 'to', 'cp1', 'cp2']
for (let id in this.points) {
// Keep track of the amount of flips (needed to allow flipping twice, but also avoid double flips in paths below)
if (flipped === null) {
flipped = this.points[id].attributes.get("flipped");
if (flipped === false) flipped = 1;
else flipped += 1;
flipped = this.points[id].attributes.get('flipped')
if (flipped === false) flipped = 1
else flipped += 1
}
this.points[id].x = this.points[id].x * -1;
this.points[id].attributes.set("flipped", flipped);
this.points[id].x = this.points[id].x * -1
this.points[id].attributes.set('flipped', flipped)
}
for (let id of Object.keys(this.paths)) {
for (let op in this.paths[id].ops) {
for (let type of ops) {
if (typeof this.paths[id].ops[op][type] !== "undefined") {
if (typeof this.paths[id].ops[op][type] !== 'undefined') {
// Path ops can use points not listed in part.points. We should only flip those here
// and not double flip the points flipped above
let wasFlipped = this.paths[id].ops[op][type].attributes.get(
"flipped"
);
if (wasFlipped !== false) wasFlipped = parseInt(wasFlipped);
let wasFlipped = this.paths[id].ops[op][type].attributes.get('flipped')
if (wasFlipped !== false) wasFlipped = parseInt(wasFlipped)
if (wasFlipped !== flipped) {
this.paths[id].ops[op][type].x =
this.paths[id].ops[op][type].x * -1;
this.paths[id].ops[op][type].attributes.set("flipped", flipped);
this.paths[id].ops[op][type].x = this.paths[id].ops[op][type].x * -1
this.paths[id].ops[op][type].attributes.set('flipped', flipped)
}
}
}
@ -45,11 +42,10 @@ export default {
for (let id of Object.keys(this.snippets)) {
// Snippets use points not listed in part.points. We should only flip those here
// and not double flip the points flipped above
let wasFlipped = this.snippets[id].anchor.attributes.get("flipped");
if (wasFlipped !== false) wasFlipped = parseInt(wasFlipped);
if (wasFlipped !== flipped)
this.snippets[id].anchor.x = this.snippets[id].anchor.x * -1;
let wasFlipped = this.snippets[id].anchor.attributes.get('flipped')
if (wasFlipped !== false) wasFlipped = parseInt(wasFlipped)
if (wasFlipped !== flipped) this.snippets[id].anchor.x = this.snippets[id].anchor.x * -1
}
}
}
};
}