From 922b9b5bd07090483cdb05f538a3fb1b3b05b189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 19 Apr 2013 11:54:16 -0700 Subject: [PATCH] Rename _cloning parameter to _preserve. --- src/item/Item.js | 26 +++++++++++++------------- src/path/CompoundPath.js | 4 ++-- src/path/Path.js | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index cdf1d3e2..aa18e094 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1378,9 +1378,9 @@ var Item = this.Item = Base.extend(Callback, { * * @param {Item} item The item to be added as a child */ - addChild: function(item, _cloning) { - // Pass on internal _cloning boolean, for CompoundPath#insertChild - return this.insertChild(undefined, item, _cloning); + addChild: function(item, _preserve) { + // Pass on internal _preserve boolean, for CompoundPath#insertChild + return this.insertChild(undefined, item, _preserve); }, /** @@ -1391,8 +1391,8 @@ var Item = this.Item = Base.extend(Callback, { * @param {Number} index * @param {Item} item The item to be appended as a child */ - insertChild: function(index, item, _cloning) { - // _cloning parameter is not used here, but CompoundPath#insertChild() + insertChild: function(index, item, _preserve) { + // _preserve parameter is not used here, but CompoundPath#insertChild() // needs it. if (this._children) { item._remove(true); @@ -1416,8 +1416,8 @@ var Item = this.Item = Base.extend(Callback, { * * @param {Item[]} items The items to be added as children */ - addChildren: function(items, _cloning) { - return this.insertChildren(this._children.length, items, _cloning); + addChildren: function(items, _preserve) { + return this.insertChildren(this._children.length, items, _preserve); }, /** @@ -1428,7 +1428,7 @@ var Item = this.Item = Base.extend(Callback, { * @param {Number} index * @param {Item[]} items The items to be appended as children */ - insertChildren: function(index, items, _cloning) { + insertChildren: function(index, items, _preserve) { // We need to clone items because it might be // an Item#children array. Use Array.prototype.slice because // in certain cases items is an arguments object @@ -1437,7 +1437,7 @@ var Item = this.Item = Base.extend(Callback, { length = children.length, i = index; for (var j = 0, l = items && items.length; j < l; j++) { - if (this.insertChild(i, items[j], _cloning)) { + if (this.insertChild(i, items[j], _preserve)) { // We need to keep track of how much the list actually grows, // bcause we might be removing and inserting into the same list, // in which case the size would not chage. @@ -1455,11 +1455,11 @@ var Item = this.Item = Base.extend(Callback, { * @param {Item} item The item above which it should be inserted * @return {Boolean} {@true it was inserted} */ - insertAbove: function(item, _cloning) { + insertAbove: function(item, _preserve) { var index = item._index; if (item._parent == this._parent && index < this._index) index++; - return item._parent.insertChild(index, this, _cloning); + return item._parent.insertChild(index, this, _preserve); }, /** @@ -1468,11 +1468,11 @@ var Item = this.Item = Base.extend(Callback, { * @param {Item} item The item above which it should be inserted * @return {Boolean} {@true it was inserted} */ - insertBelow: function(item, _cloning) { + insertBelow: function(item, _preserve) { var index = item._index; if (item._parent == this._parent && index > this._index) index--; - return item._parent.insertChild(index, this, _cloning); + return item._parent.insertChild(index, this, _preserve); }, /** diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 6d9c47d2..7661aba4 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -60,7 +60,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath# this.addChildren(Array.isArray(arg) ? arg : arguments); }, - insertChild: function(index, item, _cloning) { + insertChild: function(index, item, _preserve) { // Only allow the insertion of paths if (item._type !== 'path') return null; @@ -69,7 +69,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath# // to anti-clockwise orientation, so that they appear as holes, but // only if their orientation was not already specified before // (= _clockwise is defined). - if (!_cloning && item && item._clockwise === undefined) + if (!_preserve && item && item._clockwise === undefined) item.setClockwise(item._index == 0); return item; }, diff --git a/src/path/Path.js b/src/path/Path.js index a57884be..d5b3f232 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1069,7 +1069,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ // will happen below. path = this; } else if (index > 0) { - // Pass true for _cloning, in case of CompoundPath, to avoid + // Pass true for _preserve, in case of CompoundPath, to avoid // reversing of path direction, which would mess with segs! // Use _clone to copy over all other attributes, including style path = this._clone(new Path().insertAbove(this, true));