mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Issue fixes for Image cache, ParticleSystem & loadResDir (#2997)
* Remove Image object from loader cache when cleanup * Fix ParticleSystem still render after uncheck preview * Fix issue when loadResDir not passing completeCallback
This commit is contained in:
@@ -537,10 +537,12 @@ var Texture2D = cc.Class({
|
||||
this.loaded = true;
|
||||
this.emit("load");
|
||||
|
||||
if (cc.macro.CLEANUP_IMAGE_CACHE) {
|
||||
if (cc.macro.CLEANUP_IMAGE_CACHE && this._image instanceof HTMLImageElement) {
|
||||
// wechat game platform will cache image parsed data,
|
||||
// so image will consume much more memory than web, releasing it
|
||||
this._image.src = "";
|
||||
// Release image in loader cache
|
||||
cc.loader.removeItem(this._image.id);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -656,7 +656,7 @@ proto.loadResDir = function (url, type, progressCallback, completeCallback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
completeCallback(errors, assetRes, urlRes);
|
||||
completeCallback && completeCallback(errors, assetRes, urlRes);
|
||||
}, urls);
|
||||
};
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ function downloadImage (item, callback, isCrossOrigin, img) {
|
||||
img.removeEventListener('load', loadCallback);
|
||||
img.removeEventListener('error', errorCallback);
|
||||
|
||||
img.id = item.id;
|
||||
callback(null, img);
|
||||
}
|
||||
function errorCallback () {
|
||||
|
||||
@@ -130,6 +130,7 @@ var properties = {
|
||||
this.resetSystem();
|
||||
if ( !this.preview ) {
|
||||
this.stopSystem();
|
||||
this.disableRender();
|
||||
}
|
||||
cc.engine.repaintInEditMode();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user