From 4c297f56dec369b270a7b692a2fbe661d303802a Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Sat, 26 May 2018 12:33:14 +0200 Subject: fixes and addition in SVG.PointArray (#805) - fixed SVG.PointArray having a reference to outside array in some cases - added possibility to pass an array of point objects to SVG.PointArray --- src/pointarray.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/pointarray.js') diff --git a/src/pointarray.js b/src/pointarray.js index b0a3d54..dae836e 100644 --- a/src/pointarray.js +++ b/src/pointarray.js @@ -49,7 +49,11 @@ SVG.extend(SVG.PointArray, { if (Array.isArray(array)) { // and it is not flat, there is no need to parse it if(Array.isArray(array[0])) { - return array + // make sure to use a clone + return array.map(function (el) { return el.slice() }) + } else if (array[0].x != null){ + // allow point objects to be passed + return array.map(function (el) { return [el.x, el.y] }) } } else { // Else, it is considered as a string // parse points -- cgit v1.2.3