mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Fix the way multiple children with the same name are handled.
This commit is contained in:
parent
c064cb6c43
commit
93ba42259b
1 changed files with 3 additions and 1 deletions
|
@ -328,7 +328,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
var children = parent._children,
|
var children = parent._children,
|
||||||
namedChildren = parent._namedChildren;
|
namedChildren = parent._namedChildren;
|
||||||
(namedChildren[name] = namedChildren[name] || []).push(this);
|
(namedChildren[name] = namedChildren[name] || []).push(this);
|
||||||
children[name] = this;
|
// Only set this item if there isn't one under the same name already
|
||||||
|
if (!(name in children))
|
||||||
|
children[name] = this;
|
||||||
}
|
}
|
||||||
this._name = name || undefined;
|
this._name = name || undefined;
|
||||||
this._changed(/*#=*/ChangeFlag.ATTRIBUTE);
|
this._changed(/*#=*/ChangeFlag.ATTRIBUTE);
|
||||||
|
|
Loading…
Reference in a new issue