Skip to content

Commit

Permalink
The rules to ignore parent nodes or edges in the element texture cach…
Browse files Browse the repository at this point in the history
…es should be checked before the `lookup.get()` call.
  • Loading branch information
maxkfranz committed Oct 22, 2018
1 parent 0367344 commit 7305b6c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/extensions/renderer/canvas/ele-texture-cache.js
Expand Up @@ -104,6 +104,13 @@ ETCp.getElement = function( ele, bb, pxRatio, lvl, reason ){

if( bb.w === 0 || bb.h === 0 || !ele.visible() ){ return null; }

if(
( !self.allowEdgeTxrCaching && ele.isEdge() )
|| ( !self.allowParentTxrCaching && ele.isParent() )
){
return null;
}

if( lvl == null ){
lvl = Math.ceil( math.log2( zoom * pxRatio ) );
}
Expand Down Expand Up @@ -143,12 +150,7 @@ ETCp.getElement = function( ele, bb, pxRatio, lvl, reason ){
txrH = Math.ceil( eleScaledH / txrStepH ) * txrStepH;
}

if(
eleScaledH > maxTxrH
|| eleScaledW > maxTxrW
|| ( !self.allowEdgeTxrCaching && ele.isEdge() )
|| ( !self.allowParentTxrCaching && ele.isParent() )
){
if( eleScaledH > maxTxrH || eleScaledW > maxTxrW ){
return null; // caching large elements is not efficient
}

Expand Down

0 comments on commit 7305b6c

Please sign in to comment.