@@ -589,7 +589,6 @@ drawing.makeTester = function(gd) {
589589// always returns a copy of the bbox, so the caller can modify it safely
590590var savedBBoxes = [ ] ,
591591 maxSavedBBoxes = 10000 ;
592-
593592drawing . bBox = function ( node ) {
594593 // cache elements we've already measured so we don't have to
595594 // remeasure the same thing many times
@@ -598,36 +597,32 @@ drawing.bBox = function(node) {
598597 return Lib . extendFlat ( { } , savedBBoxes [ saveNum . value ] ) ;
599598 }
600599
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 ( ) ;
605602
606603 // copy the node to test into the tester
607604 var testNode = node . cloneNode ( true ) ;
608- drawing . tester . appendChild ( testNode ) ;
605+ tester . appendChild ( testNode ) ;
609606 // standardize its position... do we really want to do this?
610607 d3 . select ( testNode ) . attr ( {
611608 x : 0 ,
612609 y : 0 ,
613610 transform : ''
614611 } ) ;
615612
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' )
619615 . node ( ) . getBoundingClientRect ( ) ;
620- }
621616
622- drawing . tester . removeChild ( testNode ) ;
617+ tester . removeChild ( testNode ) ;
623618
624619 var bb = {
625620 height : testRect . height ,
626621 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
631626 } ;
632627
633628 // make sure we don't have too many saved boxes,
0 commit comments