mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Clear Item#_index when removing item and simplify #getIndex().
This commit is contained in:
parent
25c2d68f37
commit
de34f8c157
1 changed files with 2 additions and 1 deletions
|
@ -272,7 +272,7 @@ var Item = this.Item = Base.extend({
|
||||||
* The index of this item within the list of it's parent's children.
|
* The index of this item within the list of it's parent's children.
|
||||||
*/
|
*/
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
return this._index !== undefined ? this._index : null;
|
return this._index;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -283,6 +283,7 @@ var Item = this.Item = Base.extend({
|
||||||
var ok = !!Base.splice(this._parent.children, null,
|
var ok = !!Base.splice(this._parent.children, null,
|
||||||
this._index, 1).length;
|
this._index, 1).length;
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
|
this._index = null;
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue