aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-05-26 12:33:14 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-05-26 12:33:14 +0200
commit4c297f56dec369b270a7b692a2fbe661d303802a (patch)
treebcf843bdc51e32dd0a0094df0ab120c47dd1a3d1 /src
parent5520d76e4332c1a782899679ffa8cca2285a70ce (diff)
downloadsvg.js-4c297f56dec369b270a7b692a2fbe661d303802a.tar.gz
svg.js-4c297f56dec369b270a7b692a2fbe661d303802a.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/pointarray.js6
1 files changed, 5 insertions, 1 deletions
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