mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Rename _cloning parameter to _preserve.
This commit is contained in:
parent
50287cde96
commit
922b9b5bd0
3 changed files with 16 additions and 16 deletions
|
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue