From c352cf2575d77c304c3b85e51bec9bfb13ac162b Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 5 Nov 2017 17:58:53 +1300 Subject: [PATCH] Fixed issue with beziers --- sources/scripts/dotgrid.js | 5 +++-- sources/scripts/path_arc.js | 12 ++++++++---- sources/scripts/path_bezier.js | 12 ++++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sources/scripts/dotgrid.js b/sources/scripts/dotgrid.js index 8ab3700..9d8f4d2 100644 --- a/sources/scripts/dotgrid.js +++ b/sources/scripts/dotgrid.js @@ -98,10 +98,11 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca var o = e.target.getAttribute("data-operation"); if(!o){ return; } + console.log(o) if(o == "line"){ this.draw_line(); } if(o == "arc_c"){ this.draw_arc("0,1"); } - if(o == "arc_r"){ this.draw_line("0,0"); } - if(o == "bezier"){ this.draw_line(); } + if(o == "arc_r"){ this.draw_arc("0,0"); } + if(o == "bezier"){ this.draw_bezier(); } if(o == "export"){ this.export(); } } diff --git a/sources/scripts/path_arc.js b/sources/scripts/path_arc.js index cc8c35e..9beb633 100644 --- a/sources/scripts/path_arc.js +++ b/sources/scripts/path_arc.js @@ -13,11 +13,15 @@ function Path_Arc(from,to,orientation,end) html += "M"+this.from+" "; } else if(prev){ - if(prev.end && !prev.end.is_equal(this.from)){ - html += "M"+this.from+" "; + if(prev.end){ + if(!prev.end.is_equal(this.from)){ + html += "M"+this.from+" "; + } } - else if(prev.to && !prev.to.is_equal(this.from)){ - html += "M"+this.from+" "; + else if(prev.to){ + if(!prev.to.is_equal(this.from)){ + html += "M"+this.from+" "; + } } } diff --git a/sources/scripts/path_bezier.js b/sources/scripts/path_bezier.js index 2ff383d..ec02cce 100644 --- a/sources/scripts/path_bezier.js +++ b/sources/scripts/path_bezier.js @@ -12,11 +12,15 @@ function Path_Bezier(from,to,end) html += "M"+this.from+" "; } else if(prev){ - if(prev.end && !prev.end.is_equal(this.from)){ - html += "M"+this.from+" "; + if(prev.end){ + if(!prev.end.is_equal(this.from)){ + html += "M"+this.from+" "; + } } - else if(prev.to && !prev.to.is_equal(this.from)){ - html += "M"+this.from+" "; + else if(prev.to){ + if(!prev.to.is_equal(this.from)){ + html += "M"+this.from+" "; + } } }