Browse Source

Merge pull request #1341 from nockawa/master

Canvas2D Fix: spread of Opacity and Render Mode is now correct
Loïc Baumann 9 years ago
parent
commit
7c58d29515
2 changed files with 3 additions and 1 deletions
  1. 2 0
      src/Canvas2d/babylon.prim2dBase.ts
  2. 1 1
      src/Canvas2d/babylon.renderablePrim2d.ts

+ 2 - 0
src/Canvas2d/babylon.prim2dBase.ts

@@ -2748,6 +2748,8 @@
         protected _spreadActualOpacityChanged() {
         protected _spreadActualOpacityChanged() {
             for (let child of this._children) {
             for (let child of this._children) {
                 child._setFlags(SmartPropertyPrim.flagActualOpacityDirty);
                 child._setFlags(SmartPropertyPrim.flagActualOpacityDirty);
+                child._updateRenderMode();
+                child.onPrimBecomesDirty();
                 child._spreadActualOpacityChanged();
                 child._spreadActualOpacityChanged();
             }
             }
         }
         }

+ 1 - 1
src/Canvas2d/babylon.renderablePrim2d.ts

@@ -359,7 +359,7 @@
          * The setter should be used only by implementers of new primitive type.
          * The setter should be used only by implementers of new primitive type.
          */
          */
         public get isTransparent(): boolean {
         public get isTransparent(): boolean {
-            return (this._opacity<1) || this._shouldUseAlphaFromTexture() || this._isPrimTransparent();
+            return (this.actualOpacity<1) || this._shouldUseAlphaFromTexture() || this._isPrimTransparent();
         }
         }
 
 
         public get renderMode(): number {
         public get renderMode(): number {