mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Recursively call _clearBoundsCache
If the cache for an item's children is not valid anymore, that needs to propagate up the DOM tree.
This commit is contained in:
parent
853263263e
commit
cb8c94ef7e
1 changed files with 9 additions and 2 deletions
|
@ -1392,8 +1392,15 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
|||
_clearBoundsCache: function() {
|
||||
if (this._boundsCache) {
|
||||
for (var i = 0, list = this._boundsCache.list, l = list.length;
|
||||
i < l; i++)
|
||||
delete list[i]._bounds;
|
||||
i < l; i++) {
|
||||
var item = list[i];
|
||||
delete item._bounds;
|
||||
// We need to recursively call _clearBoundsCache, because if
|
||||
// the cache for this item's children is not valid anymore,
|
||||
// that propagates up the DOM tree.
|
||||
if (item != this && item._boundsCache)
|
||||
item._clearBoundsCache();
|
||||
}
|
||||
delete this._boundsCache;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue