From 5fc82e34e2aa13a9f1c435d9ad98801438a52b97 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sun, 1 Mar 2015 18:58:04 +0100 Subject: [PATCH] Fix cache canghe bug. Create a copy of the cache instead of modify it. --- src/util/arc.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/util/arc.js b/src/util/arc.js index 8075fb19..e4d4290e 100644 --- a/src/util/arc.js +++ b/src/util/arc.js @@ -153,16 +153,17 @@ fabric.util.getBoundsOfArc = function(fx, fy, rx, ry, rot, large, sweep, tx, ty) { var fromX = 0, fromY = 0, bound = [ ], bounds = [ ], - segs = arcToSegments(tx - fx, ty - fy, rx, ry, large, sweep, rot); + segs = arcToSegments(tx - fx, ty - fy, rx, ry, large, sweep, rot), + boundCopy = [[ ], [ ]]; for (var i = 0, len = segs.length; i < len; i++) { bound = getBoundsOfCurve(fromX, fromY, segs[i][0], segs[i][1], segs[i][2], segs[i][3], segs[i][4], segs[i][5]); - bound[0].x += fx; - bound[0].y += fy; - bound[1].x += fx; - bound[1].y += fy; - bounds.push(bound[0]); - bounds.push(bound[1]); + boundCopy[0].x = bound[0].x + fx; + boundCopy[0].y = bound[0].y + fy; + boundCopy[1].x = bound[1].x + fx; + boundCopy[1].y = bound[1].y + fy; + bounds.push(boundCopy[0]); + bounds.push(boundCopy[1]); fromX = segs[i][4]; fromY = segs[i][5]; }