@@ -589,7 +589,6 @@ drawing.makeTester = function(gd) {
589
589
// always returns a copy of the bbox, so the caller can modify it safely
590
590
var savedBBoxes = [ ] ,
591
591
maxSavedBBoxes = 10000 ;
592
-
593
592
drawing . bBox = function ( node ) {
594
593
// cache elements we've already measured so we don't have to
595
594
// remeasure the same thing many times
@@ -598,36 +597,32 @@ drawing.bBox = function(node) {
598
597
return Lib . extendFlat ( { } , savedBBoxes [ saveNum . value ] ) ;
599
598
}
600
599
601
- if ( ! drawing . test3 ) {
602
- drawing . test3 = d3 . select ( '#js-plotly-tester' ) ;
603
- drawing . tester = drawing . test3 . node ( ) ;
604
- }
600
+ var test3 = d3 . select ( '#js-plotly-tester' ) ,
601
+ tester = test3 . node ( ) ;
605
602
606
603
// copy the node to test into the tester
607
604
var testNode = node . cloneNode ( true ) ;
608
- drawing . tester . appendChild ( testNode ) ;
605
+ tester . appendChild ( testNode ) ;
609
606
// standardize its position... do we really want to do this?
610
607
d3 . select ( testNode ) . attr ( {
611
608
x : 0 ,
612
609
y : 0 ,
613
610
transform : ''
614
611
} ) ;
615
612
616
- var testRect = testNode . getBoundingClientRect ( ) ;
617
- if ( ! drawing . refRect ) {
618
- drawing . refRect = drawing . test3 . select ( '.js-reference-point' )
613
+ var testRect = testNode . getBoundingClientRect ( ) ,
614
+ refRect = test3 . select ( '.js-reference-point' )
619
615
. node ( ) . getBoundingClientRect ( ) ;
620
- }
621
616
622
- drawing . tester . removeChild ( testNode ) ;
617
+ tester . removeChild ( testNode ) ;
623
618
624
619
var bb = {
625
620
height : testRect . height ,
626
621
width : testRect . width ,
627
- left : testRect . left - drawing . refRect . left ,
628
- top : testRect . top - drawing . refRect . top ,
629
- right : testRect . right - drawing . refRect . left ,
630
- bottom : testRect . bottom - drawing . refRect . top
622
+ left : testRect . left - refRect . left ,
623
+ top : testRect . top - refRect . top ,
624
+ right : testRect . right - refRect . left ,
625
+ bottom : testRect . bottom - refRect . top
631
626
} ;
632
627
633
628
// make sure we don't have too many saved boxes,
0 commit comments