From c06fcc94dc7b1c8ddf753a20990bf6f08853b258 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 16 Apr 2018 14:32:54 +1200 Subject: [PATCH 1/5] Progress on merging paths --- desktop/sources/scripts/tool.js | 36 +++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index 45370c5..6ff1b6f 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -171,7 +171,17 @@ function Tool() var html = ""; for(id in layer){ var segment = layer[id]; - html += segment.type == "close" ? "Z " : this.render(segment); + html += segment.type == "close" ? "Z " : this.render(segment,0); + + // Three-folds + html += segment.type == "close" ? "Z " : this.render(segment,120); + html += segment.type == "close" ? "Z " : this.render(segment,240); + + // Five-folds + // html += segment.type == "close" ? "Z " : this.render(segment,72); + // html += segment.type == "close" ? "Z " : this.render(segment,72*2); + // html += segment.type == "close" ? "Z " : this.render(segment,72*3); + // html += segment.type == "close" ? "Z " : this.render(segment,72*4); } return html } @@ -181,7 +191,7 @@ function Tool() return [this.path(this.layers[0]),this.path(this.layers[1]),this.path(this.layers[2])] } - this.render = function(segment) + this.render = function(segment, angle = 0) { var type = segment.type; var verteces = segment.verteces; @@ -190,11 +200,15 @@ function Tool() for(id in verteces){ if(skip > 0){ skip -= 1; continue; } - if(id == 0){ html += `M${verteces[id].x},${verteces[id].y} `; } - var vertex = verteces[id]; + + var vertex = this.mirror_mod(verteces[id],angle); var next = verteces[parseInt(id)+1] var after_next = verteces[parseInt(id)+2] + if(id == 0){ + html += `M${vertex.x},${vertex.y} `; continue; + } + if(type == "line"){ html += `L${vertex.x},${vertex.y} `; } @@ -213,6 +227,20 @@ function Tool() return html } + this.mirror_mod = function(vertex,angle) + { + return rotate_point(vertex.x,vertex.y,150,150,angle) + } + + function rotate_point(pointX, pointY, originX, originY, angle) + { + angle = angle * Math.PI / 180.0; + return { + x: Math.cos(angle) * (pointX-originX) - Math.sin(angle) * (pointY-originY) + originX, + y: Math.sin(angle) * (pointX-originX) + Math.cos(angle) * (pointY-originY) + originY + }; + } + this.translate = function(a,b) { for(segment_id in this.layer()){ From 3ea004281a6c5015e7f011861a66f2453d648800 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 16 Apr 2018 14:48:29 +1200 Subject: [PATCH 2/5] Progress on mirrors --- desktop/sources/scripts/tool.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index 6ff1b6f..2b790ca 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -172,10 +172,19 @@ function Tool() for(id in layer){ var segment = layer[id]; html += segment.type == "close" ? "Z " : this.render(segment,0); + + // Horizontal Mirror + // html += segment.type == "close" ? "Z " : this.render(segment,0,dotgrid.width,0); + + // Vertical Mirror + html += segment.type == "close" ? "Z " : this.render(segment,0,false,true); + + // Single-fold + // html += segment.type == "close" ? "Z " : this.render(segment,180); // Three-folds - html += segment.type == "close" ? "Z " : this.render(segment,120); - html += segment.type == "close" ? "Z " : this.render(segment,240); + // html += segment.type == "close" ? "Z " : this.render(segment,120); + // html += segment.type == "close" ? "Z " : this.render(segment,240); // Five-folds // html += segment.type == "close" ? "Z " : this.render(segment,72); @@ -191,7 +200,7 @@ function Tool() return [this.path(this.layers[0]),this.path(this.layers[1]),this.path(this.layers[2])] } - this.render = function(segment, angle = 0) + this.render = function(segment, angle = 0, mirror_x = false, mirror_y = false) { var type = segment.type; var verteces = segment.verteces; @@ -201,9 +210,9 @@ function Tool() for(id in verteces){ if(skip > 0){ skip -= 1; continue; } - var vertex = this.mirror_mod(verteces[id],angle); - var next = verteces[parseInt(id)+1] - var after_next = verteces[parseInt(id)+2] + var vertex = this.mirror_mod(verteces[id],angle,mirror_x,mirror_y); + var next = this.mirror_mod(verteces[parseInt(id)+1],angle,mirror_x,mirror_y) + var after_next = this.mirror_mod(verteces[parseInt(id)+2],angle,mirror_x,mirror_y) if(id == 0){ html += `M${vertex.x},${vertex.y} `; continue; @@ -227,9 +236,17 @@ function Tool() return html } - this.mirror_mod = function(vertex,angle) + this.mirror_mod = function(vertex,angle,mirror_x = false,mirror_y = false) { - return rotate_point(vertex.x,vertex.y,150,150,angle) + if(!vertex){ return null; } + + if(mirror_x == true){ + return {x:dotgrid.width - vertex.x,y:vertex.y} + } + if(mirror_y == true){ + return {x:vertex.x,y:dotgrid.height - vertex.y} + } + return rotate_point(vertex.x,vertex.y,dotgrid.width/2,dotgrid.height/2,angle) } function rotate_point(pointX, pointY, originX, originY, angle) From 235cb7ec2ea9bae0169cea7e5df207d119f8fef5 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 16 Apr 2018 15:13:29 +1200 Subject: [PATCH 3/5] Removed old artifacts --- desktop/sources/scripts/dotgrid.js | 64 +++--------------------------- desktop/sources/scripts/tool.js | 48 +++++++++++++++------- 2 files changed, 39 insertions(+), 73 deletions(-) diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index 6a07679..1456ca3 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -32,15 +32,10 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) var cursor = null; this.svg_el = null; - this.mirror_el = null; - this.mirror = false; this.layer_1 = document.createElementNS("http://www.w3.org/2000/svg", "path"); this.layer_1.id = "layer_1"; this.layer_1.style.stroke = "black"; this.layer_2 = document.createElementNS("http://www.w3.org/2000/svg", "path"); this.layer_2.id = "layer_2"; this.layer_2.style.stroke = "#999"; this.layer_3 = document.createElementNS("http://www.w3.org/2000/svg", "path"); this.layer_3.id = "layer_3"; this.layer_3.style.stroke = "#ccc"; - this.mirror_layer_1 = document.createElementNS("http://www.w3.org/2000/svg", "path"); this.mirror_layer_1.id = "mirror_layer_1"; this.mirror_layer_1.style.stroke = "black"; - this.mirror_layer_2 = document.createElementNS("http://www.w3.org/2000/svg", "path"); this.mirror_layer_2.id = "mirror_layer_2"; this.mirror_layer_2.style.stroke = "#999"; - this.mirror_layer_3 = document.createElementNS("http://www.w3.org/2000/svg", "path"); this.mirror_layer_3.id = "mirror_layer_3"; this.mirror_layer_3.style.stroke = "#ccc"; - + this.install = function() { document.getElementById("app").appendChild(this.wrapper); @@ -65,7 +60,6 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.element.appendChild(this.cursor_y); this.offset_el = document.createElementNS("http://www.w3.org/2000/svg", "g"); - this.mirror_el = document.createElementNS("http://www.w3.org/2000/svg", "g"); // Vector this.svg_el = document.createElementNS("http://www.w3.org/2000/svg", "svg"); this.svg_el.setAttribute("class","vector"); @@ -96,14 +90,10 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.preview_el.style.fill = "none"; this.element.appendChild(this.preview_el); - this.mirror_el.appendChild(this.mirror_layer_3) this.offset_el.appendChild(this.layer_3) - this.mirror_el.appendChild(this.mirror_layer_2) this.offset_el.appendChild(this.layer_2) - this.mirror_el.appendChild(this.mirror_layer_1) this.offset_el.appendChild(this.layer_1) this.svg_el.appendChild(this.offset_el); - this.svg_el.appendChild(this.mirror_el); this.theme.start(); this.tool.start(); @@ -422,7 +412,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.mod_mirror = function() { this.mirror_index += 1; - this.mirror_index = this.mirror_index > 3 ? 0 : this.mirror_index; + this.mirror_index = this.mirror_index > 6 ? 0 : this.mirror_index; this.draw(); } @@ -473,10 +463,6 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.layer_1.setAttribute("d",paths[0]); this.layer_2.setAttribute("d",paths[1]); this.layer_3.setAttribute("d",paths[2]); - - this.mirror_layer_1.setAttribute("d",this.mirror_index > 0 ? paths[0] : "M0,0"); - this.mirror_layer_2.setAttribute("d",this.mirror_index > 0 ? paths[1] : "M0,0"); - this.mirror_layer_3.setAttribute("d",this.mirror_index > 0 ? paths[2] : "M0,0"); this.svg_el.style.width = this.width; this.svg_el.style.height = this.height; @@ -487,61 +473,21 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.layer_1.style.stroke = this.tool.styles[0].color; this.layer_1.style.fill = this.tool.styles[0].fill; this.layer_1.style.strokeDasharray = `${this.tool.styles[0].dash[0] * this.tool.styles[0].thickness},${this.tool.styles[0].dash[1] * this.tool.styles[0].thickness}`; - this.mirror_layer_1.style.strokeWidth = this.tool.styles[0].thickness; - this.mirror_layer_1.style.strokeLinecap = this.tool.styles[0].strokeLinecap; - this.mirror_layer_1.style.strokeLinejoin = this.tool.styles[0].strokeLinejoin; - this.mirror_layer_1.style.stroke = this.tool.styles[0].color; - this.mirror_layer_1.style.fill = this.tool.styles[0].fill; - this.mirror_layer_1.style.strokeDasharray = `${this.tool.styles[0].dash[0] * this.tool.styles[0].thickness},${this.tool.styles[0].dash[1] * this.tool.styles[0].thickness}`; - + this.layer_2.style.strokeWidth = this.tool.styles[1].thickness; this.layer_2.style.strokeLinecap = this.tool.styles[1].strokeLinecap; this.layer_2.style.strokeLinejoin = this.tool.styles[1].strokeLinejoin; this.layer_2.style.stroke = this.tool.styles[1].color; this.layer_2.style.fill = this.tool.styles[1].fill; this.layer_2.style.strokeDasharray = `${this.tool.styles[1].dash[0] * this.tool.styles[1].thickness},${this.tool.styles[1].dash[1] * this.tool.styles[1].thickness}`; - this.mirror_layer_2.style.strokeWidth = this.tool.styles[1].thickness; - this.mirror_layer_2.style.strokeLinecap = this.tool.styles[1].strokeLinecap; - this.mirror_layer_2.style.strokeLinejoin = this.tool.styles[1].strokeLinejoin; - this.mirror_layer_2.style.stroke = this.tool.styles[1].color; - this.mirror_layer_2.style.fill = this.tool.styles[1].fill; - this.mirror_layer_2.style.strokeDasharray = `${this.tool.styles[1].dash[0] * this.tool.styles[1].thickness},${this.tool.styles[1].dash[1] * this.tool.styles[1].thickness}`; - + this.layer_3.style.strokeWidth = this.tool.styles[2].thickness; this.layer_3.style.strokeLinecap = this.tool.styles[2].strokeLinecap; this.layer_3.style.strokeLinejoin = this.tool.styles[2].strokeLinejoin; this.layer_3.style.stroke = this.tool.styles[2].color; this.layer_3.style.fill = this.tool.styles[2].fill; this.layer_3.style.strokeDasharray = `${this.tool.styles[2].dash[0] * this.tool.styles[2].thickness},${this.tool.styles[2].dash[1] * this.tool.styles[2].thickness}`; - this.mirror_layer_3.style.strokeWidth = this.tool.styles[2].thickness; - this.mirror_layer_3.style.strokeLinecap = this.tool.styles[2].strokeLinecap; - this.mirror_layer_3.style.strokeLinejoin = this.tool.styles[2].strokeLinejoin; - this.mirror_layer_3.style.stroke = this.tool.styles[2].color; - this.mirror_layer_3.style.fill = this.tool.styles[2].fill; - this.mirror_layer_3.style.strokeDasharray = `${this.tool.styles[2].dash[0] * this.tool.styles[2].thickness},${this.tool.styles[2].dash[1] * this.tool.styles[2].thickness}`; - - // Draw Mirror - if(this.mirror_index == 1){ - this.mirror_layer_1.setAttribute("transform",`translate(${this.width},0),scale(-1,1)`) - this.mirror_layer_2.setAttribute("transform",`translate(${this.width},0),scale(-1,1)`) - this.mirror_layer_3.setAttribute("transform",`translate(${this.width},0),scale(-1,1)`) - } - else if(this.mirror_index == 2){ - this.mirror_layer_1.setAttribute("transform",`translate(0,${this.height}),scale(1,-1)`) - this.mirror_layer_2.setAttribute("transform",`translate(0,${this.height}),scale(1,-1)`) - this.mirror_layer_3.setAttribute("transform",`translate(0,${this.height}),scale(1,-1)`) - } - else if(this.mirror_index == 3){ - this.mirror_layer_1.setAttribute("transform",`translate(${this.width},${this.height}),scale(-1,-1)`) - this.mirror_layer_2.setAttribute("transform",`translate(${this.width},${this.height}),scale(-1,-1)`) - this.mirror_layer_3.setAttribute("transform",`translate(${this.width},${this.height}),scale(-1,-1)`) - } - else{ - this.mirror_layer_1.setAttribute("transform","") - this.mirror_layer_2.setAttribute("transform","") - this.mirror_layer_3.setAttribute("transform","") - } - + this.offset_el.setAttribute("transform","translate(0,0)") this.preview(); diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index 2b790ca..4abf276 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -174,23 +174,43 @@ function Tool() html += segment.type == "close" ? "Z " : this.render(segment,0); // Horizontal Mirror - // html += segment.type == "close" ? "Z " : this.render(segment,0,dotgrid.width,0); - + if(dotgrid.mirror_index == 0){ + html += segment.type == "close" ? "Z " : this.render(segment,0,true,false); + } // Vertical Mirror - html += segment.type == "close" ? "Z " : this.render(segment,0,false,true); - + if(dotgrid.mirror_index == 1){ + html += segment.type == "close" ? "Z " : this.render(segment,0,false,true); + } // Single-fold - // html += segment.type == "close" ? "Z " : this.render(segment,180); - - // Three-folds - // html += segment.type == "close" ? "Z " : this.render(segment,120); - // html += segment.type == "close" ? "Z " : this.render(segment,240); - + if(dotgrid.mirror_index == 2){ + html += segment.type == "close" ? "Z " : this.render(segment,180,false,false); + } + // Three-fold + if(dotgrid.mirror_index == 3){ + html += segment.type == "close" ? "Z " : this.render(segment,120,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,240,false,false); + } + // Four-fold + if(dotgrid.mirror_index == 4){ + html += segment.type == "close" ? "Z " : this.render(segment,90,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,180,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,270,false,false); + } // Five-folds - // html += segment.type == "close" ? "Z " : this.render(segment,72); - // html += segment.type == "close" ? "Z " : this.render(segment,72*2); - // html += segment.type == "close" ? "Z " : this.render(segment,72*3); - // html += segment.type == "close" ? "Z " : this.render(segment,72*4); + if(dotgrid.mirror_index == 5){ + html += segment.type == "close" ? "Z " : this.render(segment,72,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,72*2,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,72*3,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,72*4,false,false); + } + // Six-folds + if(dotgrid.mirror_index == 6){ + html += segment.type == "close" ? "Z " : this.render(segment,60,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,60*2,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,60*3,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,60*4,false,false); + html += segment.type == "close" ? "Z " : this.render(segment,60*5,false,false); + } } return html } From 932b5af7c7f70309e16ab745c885fd1ee16e1ee0 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 16 Apr 2018 16:24:09 +1200 Subject: [PATCH 4/5] Separated the mirror render per layer --- desktop/sources/scripts/dotgrid.js | 6 ++---- desktop/sources/scripts/tool.js | 34 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index 1456ca3..26845d7 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -407,12 +407,10 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.draw(); } - this.mirror_index = 0; - this.mod_mirror = function() { - this.mirror_index += 1; - this.mirror_index = this.mirror_index > 6 ? 0 : this.mirror_index; + this.tool.style().mirror_style += 1; + this.tool.style().mirror_style = this.tool.style().mirror_style > 7 ? 0 : this.tool.style().mirror_style; this.draw(); } diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index 4abf276..d557076 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -3,9 +3,9 @@ function Tool() this.index = 0; this.layers = [[],[],[]]; this.styles = [ - {thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#f00",fill:"none",dash:[0,0]}, - {thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#0f0",fill:"none",dash:[0,0]}, - {thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#00f",fill:"none",dash:[0,0]} + {thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#f00",fill:"none",dash:[0,0],mirror_style:0}, + {thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#0f0",fill:"none",dash:[0,0],mirror_style:0}, + {thickness:5,strokeLinecap:"round",strokeLinejoin:"round",color:"#00f",fill:"none",dash:[0,0],mirror_style:0} ]; this.verteces = []; this.reqs = {line:2,arc_c:2,arc_r:2,bezier:3,close:0}; @@ -164,47 +164,47 @@ function Tool() return this.verteces.length >= this.reqs[type]; } - this.path = function(layer = this.layer()) + this.path = function(layer_id = 0) { - if(layer.length > 0 && layer[0].type == "close"){ return ""; } - + var layer = this.layers[layer_id]; + var html = ""; for(id in layer){ var segment = layer[id]; html += segment.type == "close" ? "Z " : this.render(segment,0); // Horizontal Mirror - if(dotgrid.mirror_index == 0){ + if(this.styles[layer_id].mirror_style == 1){ html += segment.type == "close" ? "Z " : this.render(segment,0,true,false); } // Vertical Mirror - if(dotgrid.mirror_index == 1){ + if(this.styles[layer_id].mirror_style == 2){ html += segment.type == "close" ? "Z " : this.render(segment,0,false,true); } // Single-fold - if(dotgrid.mirror_index == 2){ + if(this.styles[layer_id].mirror_style == 3){ html += segment.type == "close" ? "Z " : this.render(segment,180,false,false); } // Three-fold - if(dotgrid.mirror_index == 3){ + if(this.styles[layer_id].mirror_style == 4){ html += segment.type == "close" ? "Z " : this.render(segment,120,false,false); html += segment.type == "close" ? "Z " : this.render(segment,240,false,false); } // Four-fold - if(dotgrid.mirror_index == 4){ + if(this.styles[layer_id].mirror_style == 5){ html += segment.type == "close" ? "Z " : this.render(segment,90,false,false); html += segment.type == "close" ? "Z " : this.render(segment,180,false,false); html += segment.type == "close" ? "Z " : this.render(segment,270,false,false); } // Five-folds - if(dotgrid.mirror_index == 5){ + if(this.styles[layer_id].mirror_style == 6){ html += segment.type == "close" ? "Z " : this.render(segment,72,false,false); html += segment.type == "close" ? "Z " : this.render(segment,72*2,false,false); html += segment.type == "close" ? "Z " : this.render(segment,72*3,false,false); html += segment.type == "close" ? "Z " : this.render(segment,72*4,false,false); } // Six-folds - if(dotgrid.mirror_index == 6){ + if(this.styles[layer_id].mirror_style == 7){ html += segment.type == "close" ? "Z " : this.render(segment,60,false,false); html += segment.type == "close" ? "Z " : this.render(segment,60*2,false,false); html += segment.type == "close" ? "Z " : this.render(segment,60*3,false,false); @@ -217,7 +217,7 @@ function Tool() this.paths = function() { - return [this.path(this.layers[0]),this.path(this.layers[1]),this.path(this.layers[2])] + return [this.path(0),this.path(1),this.path(2)] } this.render = function(segment, angle = 0, mirror_x = false, mirror_y = false) @@ -235,7 +235,7 @@ function Tool() var after_next = this.mirror_mod(verteces[parseInt(id)+2],angle,mirror_x,mirror_y) if(id == 0){ - html += `M${vertex.x},${vertex.y} `; continue; + html += `M${vertex.x},${vertex.y} `; } if(type == "line"){ @@ -261,10 +261,10 @@ function Tool() if(!vertex){ return null; } if(mirror_x == true){ - return {x:dotgrid.width - vertex.x,y:vertex.y} + return {x:(dotgrid.width - vertex.x),y:vertex.y} } if(mirror_y == true){ - return {x:vertex.x,y:dotgrid.height - vertex.y} + return {x:vertex.x,y:(dotgrid.height - vertex.y)+(dotgrid.height/2)} } return rotate_point(vertex.x,vertex.y,dotgrid.width/2,dotgrid.height/2,angle) } From 6fe5a917997dd419d764bdebca94c6f6de286904 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 16 Apr 2018 16:36:20 +1200 Subject: [PATCH 5/5] Added symmetry to preview --- desktop/sources/scripts/dotgrid.js | 2 +- desktop/sources/scripts/tool.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index 26845d7..5e5d1ea 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -368,7 +368,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y) this.preview = function(operation) { if(this.preview_prev == operation){ return; } - this.preview_el.innerHTML = !operation ? `` : ``; + this.preview_el.innerHTML = !operation ? `` : ``; this.preview_prev = operation; } diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index d557076..2ddff75 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -164,9 +164,9 @@ function Tool() return this.verteces.length >= this.reqs[type]; } - this.path = function(layer_id = 0) + this.path = function(layer_id = 0, preview = null) { - var layer = this.layers[layer_id]; + var layer = preview ? preview : this.layers[layer_id]; var html = ""; for(id in layer){