diff --git a/examples/Scripts/BouncingBalls.html b/examples/Scripts/BouncingBalls.html index ee75458a..0d9051bb 100644 --- a/examples/Scripts/BouncingBalls.html +++ b/examples/Scripts/BouncingBalls.html @@ -41,7 +41,7 @@ overlayColor.alpha = 0.5; var overlayGradient = new Gradient([new RgbColor(1, 1, 1, 0.5), new RgbColor(1, 1, 1, 1)]); overlay.fillColor = new GradientColor(overlayGradient, overlayPos, overlayPos + this.radius / 2); - this.item = new Group([compound, overlay]); + this.item = new Group(compound, overlay); }, iterate: function() { diff --git a/examples/Tools/Vektor.html b/examples/Tools/Vektor.html index f18110e5..827cceda 100644 --- a/examples/Tools/Vektor.html +++ b/examples/Tools/Vektor.html @@ -49,14 +49,14 @@ items = []; var arrowVector = vector.normalize(10); var end = vectorStart + vector; - vectorItem = new Group([ - new Path([vectorStart, end]), - new Path([ + vectorItem = new Group( + new Path(vectorStart, end), + new Path( end + arrowVector.rotate(135), end, end + arrowVector.rotate(-135) - ]) - ]); + ) + ); vectorItem.strokeWidth = 0.75; vectorItem.strokeColor = '#e4141b'; // Display: diff --git a/src/item/Group.js b/src/item/Group.js index 7d2922b8..fa7fc747 100644 --- a/src/item/Group.js +++ b/src/item/Group.js @@ -73,8 +73,7 @@ var Group = this.Group = Item.extend(/** @lends Group# */{ // Allow Group to have children and named children this._children = []; this._namedChildren = {}; - this.addChildren(!items || !Array.isArray(items) - || items.length && typeof items[0] !== 'object' ? arguments : items); + this.addChildren(Array.isArray(items) ? items : arguments); }, _changed: function(flags) { diff --git a/src/item/Item.js b/src/item/Item.js index 81b9e8f7..6ee28d87 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1157,7 +1157,7 @@ function(name) { * its children list. You can use this function for groups, compound * paths and layers. * - * @param {item[]} items The items to be added as children + * @param {Item[]} items The items to be added as children */ addChildren: function(items) { this.insertChildren(this._children.length, items); diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index c3be55ea..7567e525 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -48,9 +48,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath# this._namedChildren = {}; // Do not reassign to paths, since arguments would get modified, which // we potentially use as array, depending on what is passed. - var items = !paths || !Array.isArray(paths) - || typeof paths[0] !== 'object' ? arguments : paths; - this.addChildren(items); + this.addChildren(Array.isArray(paths) ? paths : arguments); }, insertChild: function(index, item) { diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index 2576cb11..c2076373 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -310,7 +310,7 @@ new function() { // http://www.w3.org/TR/SVG/masking.html#ClipPathProperty case 'clip-path': var clipPath = getDefinition(value).clone().flatten(), - group = new Group([clipPath]); + group = new Group(clipPath); group.moveAbove(item); group.addChild(item); group.setClipped(true);