Make cascade opacity actually working (#2828)

This commit is contained in:
pandamicro
2018-06-08 10:33:34 +08:00
committed by GitHub
parent 148680aec7
commit 8bc53f72e1
2 changed files with 4 additions and 6 deletions
+1 -4
View File
@@ -905,10 +905,7 @@ var Node = cc.Class({
set (value) {
if (this._opacity !== value) {
this._opacity = value;
if (this._renderComponent) {
this._renderFlag |= RenderFlow.FLAG_COLOR;
}
this._renderFlag |= RenderFlow.FLAG_COLOR;
}
},
range: [0, 255]
+3 -2
View File
@@ -70,7 +70,8 @@ _proto._worldTransform = function (node) {
};
_proto._color = function (node) {
_walker.parentOpacityDirty ++;
let opacityLevel = (node._opacity < 255) ? 1 : 0;
_walker.parentOpacityDirty += opacityLevel;
let comp = node._renderComponent;
if (comp) {
@@ -81,7 +82,7 @@ _proto._color = function (node) {
}
this._next._func(node);
_walker.parentOpacityDirty --;
_walker.parentOpacityDirty -= opacityLevel;
};
_proto._updateRenderData = function (node) {