fix: release cache canvas elements in Node.clearCache()

This commit is contained in:
Dmitry Zarva 2022-11-07 16:17:46 +03:00
parent 0f00aa9401
commit d03b31f6ce

View File

@ -243,7 +243,12 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
* node.clearCache();
*/
clearCache() {
this._cache.delete(CANVAS);
if (this._cache.has(CANVAS)) {
const {scene, filter, hit} = this._cache.get(CANVAS);
Util.releaseCanvas(scene, filter, hit);
this._cache.delete(CANVAS);
}
this._clearSelfAndDescendantCache();
this._requestDraw();
return this;