@@ -3706,13 +3706,29 @@ function purge(gd) {
3706
3706
return gd ;
3707
3707
}
3708
3708
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
+
3709
3723
// -------------------------------------------------------
3710
3724
// makePlotFramework: Create the plot container and axes
3711
3725
// -------------------------------------------------------
3712
3726
function makePlotFramework ( gd ) {
3713
3727
var gd3 = d3 . select ( gd ) ;
3714
3728
var fullLayout = gd . _fullLayout ;
3715
- recalculateTransformInverseIfNecessary ( gd ) ;
3729
+
3730
+ fullLayout . _recalculateTransformInverseIfNecessary = recalculateTransformInverseIfNecessary ;
3731
+ fullLayout . _recalculateTransformInverseIfNecessary ( gd ) ;
3716
3732
3717
3733
// Plot container
3718
3734
fullLayout . _container = gd3 . selectAll ( '.plot-container' ) . data ( [ 0 ] ) ;
@@ -3857,20 +3873,6 @@ function makePlotFramework(gd) {
3857
3873
gd . emit ( 'plotly_framework' ) ;
3858
3874
}
3859
3875
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
-
3874
3876
exports . animate = animate ;
3875
3877
exports . addFrames = addFrames ;
3876
3878
exports . deleteFrames = deleteFrames ;
@@ -3898,6 +3900,4 @@ exports._guiRelayout = guiEdit(relayout);
3898
3900
exports . _guiRestyle = guiEdit ( restyle ) ;
3899
3901
exports . _guiUpdate = guiEdit ( update ) ;
3900
3902
3901
- exports . recalculateTransformInverseIfNecessary = recalculateTransformInverseIfNecessary ;
3902
-
3903
3903
exports . _storeDirectGUIEdit = _storeDirectGUIEdit ;
0 commit comments