@@ -542,11 +542,11 @@ drawing.steps = function(shape) {
542
542
} ;
543
543
544
544
// off-screen svg render testing element, shared by the whole page
545
- // uses the id 'js-plotly-tester' and stores it in gd._tester
545
+ // uses the id 'js-plotly-tester' and stores it in drawing.tester
546
546
// makes a hash of cached text items in tester.node()._cache
547
547
// so we can add references to rendered text (including all info
548
548
// needed to fully determine its bounding rect)
549
- drawing . makeTester = function ( gd ) {
549
+ drawing . makeTester = function ( ) {
550
550
var tester = d3 . select ( 'body' )
551
551
. selectAll ( '#js-plotly-tester' )
552
552
. data ( [ 0 ] ) ;
@@ -579,16 +579,17 @@ drawing.makeTester = function(gd) {
579
579
tester . node ( ) . _cache = { } ;
580
580
}
581
581
582
- gd . _tester = tester ;
583
- gd . _testref = testref ;
582
+ drawing . tester = tester ;
583
+ drawing . testref = testref ;
584
584
} ;
585
585
586
586
// use our offscreen tester to get a clientRect for an element,
587
587
// in a reference frame where it isn't translated and its anchor
588
588
// point is at (0,0)
589
589
// always returns a copy of the bbox, so the caller can modify it safely
590
- var savedBBoxes = [ ] ,
591
- maxSavedBBoxes = 10000 ;
590
+ var savedBBoxes = [ ] ;
591
+ var maxSavedBBoxes = 10000 ;
592
+
592
593
drawing . bBox = function ( node ) {
593
594
// cache elements we've already measured so we don't have to
594
595
// remeasure the same thing many times
@@ -597,22 +598,24 @@ drawing.bBox = function(node) {
597
598
return Lib . extendFlat ( { } , savedBBoxes [ saveNum . value ] ) ;
598
599
}
599
600
600
- var test3 = d3 . select ( '#js-plotly- tester' ) ,
601
- tester = test3 . node ( ) ;
601
+ var tester3 = drawing . tester ;
602
+ var tester = tester3 . node ( ) ;
602
603
603
604
// copy the node to test into the tester
604
605
var testNode = node . cloneNode ( true ) ;
605
606
tester . appendChild ( testNode ) ;
607
+
606
608
// standardize its position... do we really want to do this?
607
609
d3 . select ( testNode ) . attr ( {
608
610
x : 0 ,
609
611
y : 0 ,
610
612
transform : ''
611
613
} ) ;
612
614
613
- var testRect = testNode . getBoundingClientRect ( ) ,
614
- refRect = test3 . select ( '.js-reference-point' )
615
- . node ( ) . getBoundingClientRect ( ) ;
615
+ var testRect = testNode . getBoundingClientRect ( ) ;
616
+ var refRect = drawing . testref
617
+ . node ( )
618
+ . getBoundingClientRect ( ) ;
616
619
617
620
tester . removeChild ( testNode ) ;
618
621
0 commit comments