@@ -3706,13 +3706,29 @@ function purge(gd) {
37063706 return gd ;
37073707}
37083708
3709+ // determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes.
3710+ function recalculateTransformInverseIfNecessary ( gd , newBBox ) {
3711+ gd = Lib . getGraphDiv ( gd ) ;
3712+ var fullLayout = gd . _fullLayout ;
3713+ if ( ! newBBox )
3714+ newBBox = gd . getBoundingClientRect ( ) ;
3715+ if ( Lib . domRectsAreEqual ( newBBox , fullLayout . _lastBBox ) )
3716+ return ;
3717+ var m = fullLayout . _inverseTransform = Lib . inverseTransformMatrix ( Lib . getFullTransformMatrix ( gd ) ) ;
3718+ fullLayout . _inverseScaleX = Math . sqrt ( m [ 0 ] [ 0 ] * m [ 0 ] [ 0 ] + m [ 0 ] [ 1 ] * m [ 0 ] [ 1 ] + m [ 0 ] [ 2 ] * m [ 0 ] [ 2 ] ) ;
3719+ fullLayout . _inverseScaleY = Math . sqrt ( m [ 1 ] [ 0 ] * m [ 1 ] [ 0 ] + m [ 1 ] [ 1 ] * m [ 1 ] [ 1 ] + m [ 1 ] [ 2 ] * m [ 1 ] [ 2 ] ) ;
3720+ fullLayout . _lastBBox = gd . getBoundingClientRect ( ) ;
3721+ }
3722+
37093723// -------------------------------------------------------
37103724// makePlotFramework: Create the plot container and axes
37113725// -------------------------------------------------------
37123726function makePlotFramework ( gd ) {
37133727 var gd3 = d3 . select ( gd ) ;
37143728 var fullLayout = gd . _fullLayout ;
3715- recalculateTransformInverseIfNecessary ( gd ) ;
3729+
3730+ fullLayout . _recalculateTransformInverseIfNecessary = recalculateTransformInverseIfNecessary ;
3731+ fullLayout . _recalculateTransformInverseIfNecessary ( gd ) ;
37163732
37173733 // Plot container
37183734 fullLayout . _container = gd3 . selectAll ( '.plot-container' ) . data ( [ 0 ] ) ;
@@ -3857,20 +3873,6 @@ function makePlotFramework(gd) {
38573873 gd . emit ( 'plotly_framework' ) ;
38583874}
38593875
3860- // determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes.
3861- function recalculateTransformInverseIfNecessary ( gd , newBBox = null ) {
3862- gd = Lib . getGraphDiv ( gd ) ;
3863- var fullLayout = gd . _fullLayout ;
3864- if ( ! newBBox )
3865- newBBox = gd . getBoundingClientRect ( ) ;
3866- if ( Lib . domRectsAreEqual ( newBBox , fullLayout . _lastBBox ) )
3867- return ;
3868- var m = fullLayout . _inverseTransform = Lib . inverseTransformMatrix ( Lib . getFullTransformMatrix ( gd ) ) ;
3869- fullLayout . _inverseScaleX = Math . sqrt ( m [ 0 ] [ 0 ] * m [ 0 ] [ 0 ] + m [ 0 ] [ 1 ] * m [ 0 ] [ 1 ] + m [ 0 ] [ 2 ] * m [ 0 ] [ 2 ] ) ;
3870- fullLayout . _inverseScaleY = Math . sqrt ( m [ 1 ] [ 0 ] * m [ 1 ] [ 0 ] + m [ 1 ] [ 1 ] * m [ 1 ] [ 1 ] + m [ 1 ] [ 2 ] * m [ 1 ] [ 2 ] ) ;
3871- fullLayout . _lastBBox = gd . getBoundingClientRect ( ) ;
3872- }
3873-
38743876exports . animate = animate ;
38753877exports . addFrames = addFrames ;
38763878exports . deleteFrames = deleteFrames ;
@@ -3898,6 +3900,4 @@ exports._guiRelayout = guiEdit(relayout);
38983900exports . _guiRestyle = guiEdit ( restyle ) ;
38993901exports . _guiUpdate = guiEdit ( update ) ;
39003902
3901- exports . recalculateTransformInverseIfNecessary = recalculateTransformInverseIfNecessary ;
3902-
39033903exports . _storeDirectGUIEdit = _storeDirectGUIEdit ;
0 commit comments