From 78167056e8907b468ead357d89ad718804ac32eb Mon Sep 17 00:00:00 2001 From: maxkfranz Date: Tue, 15 Dec 2015 16:43:17 -0500 Subject: [PATCH] fixes accounting for labels in bb and improves compound support re. updateCompoundBounds() #1194 #1196 --- src/collection/dimensions.js | 10 ++++------ src/extensions/renderer/base/coord-ele-math.js | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/collection/dimensions.js b/src/collection/dimensions.js index 3bc61c2da1..0144602b6d 100644 --- a/src/collection/dimensions.js +++ b/src/collection/dimensions.js @@ -544,14 +544,12 @@ var boundingBoxImpl = function( ele, options ){ ////////////////////////// if( styleEnabled && options.includeLabels ){ - - updateBounds( getLabelBounds( ele ) ); + updateBoundsFromBox( bounds, getLabelBounds( ele ) ); if( isEdge ){ - updateBounds( getLabelBounds( ele, 'source' ) ); - updateBounds( getLabelBounds( ele, 'target' ) ); + updateBoundsFromBox( bounds, getLabelBounds( ele, 'source' ) ); + updateBoundsFromBox( bounds, getLabelBounds( ele, 'target' ) ); } - } // style enabled for labels } // if displayed @@ -594,7 +592,7 @@ elesfn.boundingBox = function( options ){ var cy_p = eles.cy()._private; var styleEnabled = cy_p.styleEnabled; if( styleEnabled ){ - cy_p.renderer.recalculateRenderedStyle( eles.union( eles.parallelEdges() ) ); + cy_p.renderer.recalculateRenderedStyle( eles.union( eles.parallelEdges() ), !opts.useCache ); } for( var i = 0; i < eles.length; i++ ){ diff --git a/src/extensions/renderer/base/coord-ele-math.js b/src/extensions/renderer/base/coord-ele-math.js index 73fc51f8a6..9044e51da1 100644 --- a/src/extensions/renderer/base/coord-ele-math.js +++ b/src/extensions/renderer/base/coord-ele-math.js @@ -60,7 +60,7 @@ BRp.registerCalculationListeners = function(){ this.beforeRender( updateEles ); }; -BRp.recalculateRenderedStyle = function( eles ){ +BRp.recalculateRenderedStyle = function( eles, bypassCache ){ var edges = []; var nodes = []; @@ -72,7 +72,7 @@ BRp.recalculateRenderedStyle = function( eles ){ var id = _p.data.id; // only update if dirty - if( rstyle.clean ){ continue; } + if( !bypassCache && rstyle.clean ){ continue; } if( _p.group === 'nodes' ){ var pos = _p.position;