diff --git a/desktop/package.json b/desktop/package.json index dfac2de..b417acb 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -6,6 +6,7 @@ "scripts": { "start": "electron .", "lint": "eslint --ignore-path ../.gitignore .", + "fix": "standard --fix", "clean": "rm -r ~/Desktop/Dotgrid-darwin-x64/ ; rm -r ~/Desktop/Dotgrid-linux-x64/ ; rm -r ~/Desktop/Dotgrid-win32-x64/ ; rm -r ~/Desktop/Dotgrid-linux-armv7l/ ; echo 'cleaned build location'", "build_osx": "electron-packager . Dotgrid --platform=darwin --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.icns ; echo 'Built for OSX'", "build_linux": "electron-packager . Dotgrid --platform=linux --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.ico ; echo 'Built for LINUX'", diff --git a/desktop/sources/scripts/generator.js b/desktop/sources/scripts/generator.js index fca0250..efcb3f7 100644 --- a/desktop/sources/scripts/generator.js +++ b/desktop/sources/scripts/generator.js @@ -10,8 +10,8 @@ function Generator (layer, style) { for (const k1 in l) { const seg = l[k1] for (const k2 in seg.vertices) { - if (mirror == 1) { seg.vertices[k2].x = (DOTGRID.tool.settings.size.width) - seg.vertices[k2].x + 15 } - if (mirror == 2) { seg.vertices[k2].y = (DOTGRID.tool.settings.size.height) - seg.vertices[k2].y + 30 } + if (mirror == 1 || mirror == 3) { seg.vertices[k2].x = (DOTGRID.tool.settings.size.width) - seg.vertices[k2].x + 15 } + if (mirror == 2 || mirror == 3) { seg.vertices[k2].y = (DOTGRID.tool.settings.size.height) - seg.vertices[k2].y + 30 } // Offset seg.vertices[k2].x += offset.x @@ -89,20 +89,20 @@ function Generator (layer, style) { this.toString = function (offset = { x: 0, y: 0 }, scale = 1, mirror = this.style && this.style.mirror_style ? this.style.mirror_style : 0) { let s = this.convert(operate(this.layer, offset, scale)) - if (mirror == 1 || mirror == 2) { + if (mirror == 1 || mirror == 2 || mirror == 3) { s += this.convert(operate(this.layer, offset, scale, mirror), mirror) } - if (mirror == 3) { - s += this.convert(operate(this.layer, offset, scale, mirror, 120), mirror) - s += this.convert(operate(this.layer, offset, scale, mirror, 240), mirror) - } - if (mirror == 4) { - s += this.convert(operate(this.layer, offset, scale, mirror, 72), mirror) - s += this.convert(operate(this.layer, offset, scale, mirror, 144), mirror) - s += this.convert(operate(this.layer, offset, scale, mirror, 216), mirror) - s += this.convert(operate(this.layer, offset, scale, mirror, 288), mirror) - } + // if (mirror == 3) { + // s += this.convert(operate(this.layer, offset, scale, mirror, 120), mirror) + // s += this.convert(operate(this.layer, offset, scale, mirror, 240), mirror) + // } + // if (mirror == 4) { + // s += this.convert(operate(this.layer, offset, scale, mirror, 72), mirror) + // s += this.convert(operate(this.layer, offset, scale, mirror, 144), mirror) + // s += this.convert(operate(this.layer, offset, scale, mirror, 216), mirror) + // s += this.convert(operate(this.layer, offset, scale, mirror, 288), mirror) + // } return s } diff --git a/desktop/sources/scripts/interface.js b/desktop/sources/scripts/interface.js index 9ff20dc..ae682c4 100644 --- a/desktop/sources/scripts/interface.js +++ b/desktop/sources/scripts/interface.js @@ -136,7 +136,7 @@ DOTGRID.Interface = function () { if (DOTGRID.guide.show_extras) { document.getElementById('grid_path').setAttribute('d', 'M65,155 Q155,245 245,155 M65,155 Q155,65 245,155 M155,125 A30,30 0 0,1 185,155 A30,30 0 0,1 155,185 A30,30 0 0,1 125,155 A30,30 0 0,1 155,125 ') } else { document.getElementById('grid_path').setAttribute('d', 'M65,155 Q155,245 245,155 M65,155 ') } // Mirror - if (DOTGRID.tool.style().mirror_style == 0) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 M180,180 L180,180 L240,240 M210,90 L210,90 L180,120 M120,180 L120,180 L90,210') } else if (DOTGRID.tool.style().mirror_style == 1) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L240,240 M180,120 L210,90 M120,180 L90,210') } else if (DOTGRID.tool.style().mirror_style == 2) { document.getElementById('mirror_path').setAttribute('d', 'M210,90 L210,90 L90,210 M60,60 L60,60 L120,120 M180,180 L180,180 L240,240') } else if (DOTGRID.tool.style().mirror_style == 3) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 L120,120 L180,120 M120,150 L120,150 L180,150 M120,180 L120,180 L180,180 L180,180 L240,240 ') } else if (DOTGRID.tool.style().mirror_style == 4) { document.getElementById('mirror_path').setAttribute('d', 'M120,120 L120,120 L120,120 L180,120 M120,150 L120,150 L180,150 M120,180 L120,180 L180,180 L180,180 L180,180 L240,240 M120,210 L120,210 L180,210 M120,90 L120,90 L180,90 M60,60 L60,60 L120,120 ') } + if (DOTGRID.tool.style().mirror_style == 0) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 M180,180 L180,180 L240,240 M210,90 L210,90 L180,120 M120,180 L120,180 L90,210') } else if (DOTGRID.tool.style().mirror_style == 1) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L240,240 M180,120 L210,90 M120,180 L90,210') } else if (DOTGRID.tool.style().mirror_style == 2) { document.getElementById('mirror_path').setAttribute('d', 'M210,90 L210,90 L90,210 M60,60 L60,60 L120,120 M180,180 L180,180 L240,240') } else if (DOTGRID.tool.style().mirror_style == 3) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 L180,120 L210,90 M240,240 L240,240 L180,180 L120,180 L90,210') } else if (DOTGRID.tool.style().mirror_style == 4) { document.getElementById('mirror_path').setAttribute('d', 'M120,120 L120,120 L120,120 L180,120 M120,150 L120,150 L180,150 M120,180 L120,180 L180,180 L180,180 L180,180 L240,240 M120,210 L120,210 L180,210 M120,90 L120,90 L180,90 M60,60 L60,60 L120,120 ') } this.prev_operation = DOTGRID.cursor.operation } diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index 4a68871..74fb2d3 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -165,7 +165,7 @@ DOTGRID.Tool = function () { } else if (type == 'thickness') { this.style().thickness = clamp(this.style().thickness + mod, 1, 100) } else if (type == 'mirror') { - this.style().mirror_style = this.style().mirror_style > 3 ? 0 : this.style().mirror_style + 1 + this.style().mirror_style = this.style().mirror_style > 2 ? 0 : this.style().mirror_style + 1 } else { console.warn('Unknown', type) }