Skip to content

Commit

Permalink
Backport 2.x #2079 #2078 : For each 'style' dirty event, w.r.t. the e…
Browse files Browse the repository at this point in the history
…lement texture cache, manually diff the parent opacity. Invalidate the descendants when the diff is non-empty.

Ref : Opacity of child node is not updated for certain zoom levels after parent opacity is overridden #2078
  • Loading branch information
maxkfranz committed Mar 19, 2018
1 parent b15d061 commit c3b787e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/extensions/renderer/canvas/index.js
Expand Up @@ -91,6 +91,25 @@ function CanvasRenderer( options ){
// then keep cached ele texture
} else {
r.data.eleTxrCache.invalidateElement( ele );

// NB this block of code should not be ported to 3.3 (unstable branch).
// - This check is unneccesary in 3.3 as caches will be stored without respect to opacity.
// - This fix may result in lowered performance for compound graphs.
// - Ref : Opacity of child node is not updated for certain zoom levels after parent opacity is overriden #2078
if( ele.isParent() && de['style'] ){
var op1 = rs.prevParentOpacity;
var op2 = ele.pstyle('opacity').pfValue;

rs.prevParentOpacity = op2;

if( op1 !== op2 ){
var descs = ele.descendants();

for( var j = 0; j < descs.length; j++ ){
r.data.eleTxrCache.invalidateElement( descs[j] );
}
}
}
}
}

Expand Down

0 comments on commit c3b787e

Please sign in to comment.