mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Unify handling of insert
parameters.
This commit is contained in:
parent
44f98ee094
commit
62a23662fa
4 changed files with 4 additions and 4 deletions
|
@ -1445,7 +1445,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
if (!children)
|
if (!children)
|
||||||
copy.copyAttributes(this);
|
copy.copyAttributes(this);
|
||||||
// Insert is true by default.
|
// Insert is true by default.
|
||||||
if (insert || insert === undefined)
|
if (insert != false) // No double-equal!
|
||||||
copy.insertAbove(this);
|
copy.insertAbove(this);
|
||||||
// Make sure we're not overriding the original name in the same parent
|
// Make sure we're not overriding the original name in the same parent
|
||||||
var name = this._name,
|
var name = this._name,
|
||||||
|
|
|
@ -70,7 +70,7 @@ var Layer = Group.extend(/** @lends Layer# */{
|
||||||
// Call the group constructor but don't insert yet!
|
// Call the group constructor but don't insert yet!
|
||||||
props.insert = false;
|
props.insert = false;
|
||||||
Group.call(this, props);
|
Group.call(this, props);
|
||||||
if (insert || insert === undefined) {
|
if (insert != false) { // No double-equal!
|
||||||
this._project.addChild(this);
|
this._project.addChild(this);
|
||||||
// When inserted, also activate the layer by default.
|
// When inserted, also activate the layer by default.
|
||||||
this.activate();
|
this.activate();
|
||||||
|
|
|
@ -180,7 +180,7 @@ var Shape = Item.extend(/** @lends Shape# */{
|
||||||
// Respect the setting of paper.settings.applyMatrix for new paths:
|
// Respect the setting of paper.settings.applyMatrix for new paths:
|
||||||
if (paper.settings.applyMatrix)
|
if (paper.settings.applyMatrix)
|
||||||
path.setApplyMatrix(true);
|
path.setApplyMatrix(true);
|
||||||
if (insert)
|
if (insert != false) // No double-equal!
|
||||||
path.insertAbove(this);
|
path.insertAbove(this);
|
||||||
return path;
|
return path;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1504,7 +1504,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
shape._matrix.preConcatenate(this._matrix);
|
shape._matrix.preConcatenate(this._matrix);
|
||||||
// Determine and apply the shape's angle of rotation.
|
// Determine and apply the shape's angle of rotation.
|
||||||
shape.rotate(topCenter.subtract(center).getAngle() + 90);
|
shape.rotate(topCenter.subtract(center).getAngle() + 90);
|
||||||
if (insert)
|
if (insert != false) // No double-equal!
|
||||||
shape.insertAbove(this);
|
shape.insertAbove(this);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue