From 6def2b9d3a51e644a0b92c515d36021cd9cf439a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 6 Mar 2011 21:13:55 +0000 Subject: [PATCH] Clean-up Path#arcTo() code. --- src/path/Path.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/path/Path.js b/src/path/Path.js index f33bf86a..5dea700e 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -552,10 +552,8 @@ var Path = this.Path = PathItem.extend({ } } }; -}, new function() { - /** - * PostScript-style drawing commands - */ +}, new function() { // PostScript-style drawing commands + function getCurrentSegment(that) { var segments = that._segments; if (segments.length == 0) @@ -711,18 +709,22 @@ var Path = this.Path = PathItem.extend({ pt = new Point(centerX + relx * radius, centerY + rely * radius); var out; - if (i == arcSegs) out = null; - else out = new Point(centerX + (relx - z * rely) * radius - pt.x, + if (i == arcSegs) { + out = null; + } else { + out = new Point( + centerX + (relx - z * rely) * radius - pt.x, centerY + (rely + z * relx) * radius - pt.y); + } if (i == 0) { // Modify startSegment current.setHandleOut(out); } else { // Add new Segment - var inPoint = new Point( + var handleIn = new Point( centerX + (relx + z * rely) * radius - pt.x, centerY + (rely - z * relx) * radius - pt.y); - this._add(new Segment(pt, inPoint, out)); + this._add(new Segment(pt, handleIn, out)); } angle += inc; }