Fix issues (#2960)

* Fix EVENT_ENGINE_INITED callback not invoked issue

* Fix redo making disabled component enter render flow
This commit is contained in:
pandamicro
2018-07-10 16:47:17 +08:00
committed by GitHub
parent 5e84cd63e6
commit bc071a0ff0
2 changed files with 30 additions and 3 deletions
+23 -1
View File
@@ -387,6 +387,28 @@ var game = {
if (cb) cb();
},
eventTargetOn: EventTarget.prototype.on,
eventTargetOnce: EventTarget.prototype.once,
on (type, callback, target) {
// Make sure EVENT_ENGINE_INITED callbacks to be invoked
if (this._prepared && type === this.EVENT_ENGINE_INITED) {
callback.call(target);
}
else {
this.eventTargetOn(type, callback, target);
}
},
once (type, callback, target) {
// Make sure EVENT_ENGINE_INITED callbacks to be invoked
if (this._prepared && type === this.EVENT_ENGINE_INITED) {
callback.call(target);
}
else {
this.eventTargetOnce(type, callback, target);
}
},
/**
* !#en Prepare game.
* !#zh 准备引擎,请不要直接调用这个函数。
@@ -558,7 +580,7 @@ var game = {
callback = function () {
if (!self._paused) {
self._intervalId = window.requestAnimFrame(callback);
if (!CC_JSB && frameRate === 30) {
if (frameRate === 30) {
if (skip = !skip) {
return;
}
+7 -2
View File
@@ -2963,8 +2963,13 @@ var Node = cc.Class({
this._renderFlag |= RenderFlow.FLAG_TRANSFORM;
if (this._renderComponent) {
this._renderFlag |= RenderFlow.FLAG_COLOR;
this._renderComponent.markForUpdateRenderData(true);
if (this._renderComponent.enabled) {
this._renderFlag |= RenderFlow.FLAG_COLOR;
this._renderComponent.markForUpdateRenderData(true);
}
else {
this._renderComponent.disableRender();
}
}
},