move code to onRestore

This commit is contained in:
SijieWang
2018-05-07 18:16:10 +08:00
parent 0e854f3cc4
commit 9bc8c63379
+9 -9
View File
@@ -2460,15 +2460,6 @@ var Node = cc.Class({
var self = this;
var sgNode = self._sgNode;
// `active` must synchronize to component
for (var i=0; i<this._components.length; i++) {
var comp = this._components[i];
if (!comp || !comp._sgNode) {
continue;
}
comp._sgNode.visible = this.active;
}
sgNode.setPosition(self._position);
sgNode.setRotationX(self._rotationX);
sgNode.setRotationY(self._rotationY);
@@ -2514,6 +2505,15 @@ var Node = cc.Class({
_removeSgNode: SgHelper.removeSgNode,
onRestore: CC_EDITOR && function () {
// `active` must synchronize to component
for (var i=0; i<this._components.length; i++) {
var comp = this._components[i];
if (!comp || !comp._sgNode) {
continue;
}
comp._sgNode.visible = this.active;
}
this._updateDummySgNode();
var sizeProvider = this._sizeProvider;