Merge pull request #1581 from pandamicro/master

Remove dom image immediately after texture init
This commit is contained in:
Jare Guo
2017-04-12 16:16:45 +08:00
committed by GitHub
3 changed files with 8 additions and 5 deletions
-1
View File
@@ -974,7 +974,6 @@ var Node = cc.Class({
}
if (CC_JSB) {
this._releaseAllActions();
if (this._touchListener) {
this._touchListener.release();
this._touchListener.owner = null;
@@ -375,7 +375,6 @@
this._calculateTextBaseline();
this._updateTexture();
};
@@ -449,6 +448,8 @@
}
this._texture._textureLoaded = false;
// Hack. because we delete _htmlElementObj after usage in WEBGL mode
this._texture._htmlElementObj = this._labelCanvas;
this._texture.handleLoadedTexture(true);
};
+6 -3
View File
@@ -838,9 +838,10 @@ game.once(game.EVENT_RENDERER_INITED, function () {
if (!game._rendererInitialized)
return;
if (!self._htmlElementObj) {
var img = cc.loader.getRes(self.url);
if (!img) return;
self.initWithElement(img);
var tex = cc.loader.getRes(self.url);
if (!tex || !tex._htmlElementObj)
return;
self.initWithElement(tex._htmlElementObj);
}
if (!self._htmlElementObj.width || !self._htmlElementObj.height)
return;
@@ -884,6 +885,8 @@ game.once(game.EVENT_RENDERER_INITED, function () {
self.setAliasTexParameters();
}
self._htmlElementObj = null;
//dispatch load event to listener.
self.emit("load");
},