Skip to content

Commit a8fba03

Browse files
committed
replace gd._tester with drawing._tester
1 parent c3c3b3a commit a8fba03

File tree

7 files changed

+10
-12
lines changed

7 files changed

+10
-12
lines changed

src/components/drawing/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,11 @@ drawing.steps = function(shape) {
542542
};
543543

544544
// 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
546546
// makes a hash of cached text items in tester.node()._cache
547547
// so we can add references to rendered text (including all info
548548
// needed to fully determine its bounding rect)
549-
drawing.makeTester = function(gd) {
549+
drawing.makeTester = function() {
550550
var tester = d3.select('body')
551551
.selectAll('#js-plotly-tester')
552552
.data([0]);
@@ -579,7 +579,7 @@ drawing.makeTester = function(gd) {
579579
tester.node()._cache = {};
580580
}
581581

582-
drawing.tester = gd._tester = tester;
582+
drawing.tester = tester;
583583
drawing.testref = testref;
584584
};
585585

src/components/sliders/draw.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function keyFunction(opts) {
117117

118118
// Compute the dimensions (mutates sliderOpts):
119119
function findDimensions(gd, sliderOpts) {
120-
var sliderLabels = gd._tester.selectAll('g.' + constants.labelGroupClass)
120+
var sliderLabels = Drawing.tester.selectAll('g.' + constants.labelGroupClass)
121121
.data(sliderOpts.steps);
122122

123123
sliderLabels.enter().append('g')
@@ -154,7 +154,7 @@ function findDimensions(gd, sliderOpts) {
154154

155155
if(sliderOpts.currentvalue.visible) {
156156
// Get the dimensions of the current value label:
157-
var dummyGroup = gd._tester.append('g');
157+
var dummyGroup = Drawing.tester.append('g');
158158

159159
sliderLabels.each(function(stepOpts) {
160160
var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label);

src/components/updatemenus/draw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ function findDimensions(gd, menuOpts) {
504504
menuOpts.lx = 0;
505505
menuOpts.ly = 0;
506506

507-
var fakeButtons = gd._tester.selectAll('g.' + constants.dropdownButtonClassName)
507+
var fakeButtons = Drawing.tester.selectAll('g.' + constants.dropdownButtonClassName)
508508
.data(menuOpts.buttons);
509509

510510
fakeButtons.enter().append('g')

src/plot_api/plot_api.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ Plotly.plot = function(gd, data, layout, config) {
9393
d3.select(gd).classed('js-plotly-plot', true);
9494

9595
// off-screen getBoundingClientRect testing space,
96-
// in #js-plotly-tester (and stored as gd._tester)
96+
// in #js-plotly-tester (and stored as Drawing.tester)
9797
// so we can share cached text across tabs
98-
Drawing.makeTester(gd);
98+
Drawing.makeTester();
9999

100100
// collect promises for any async actions during plotting
101101
// any part of the plotting code can push to gd._promises, then

src/plots/plots.js

-1
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,6 @@ plots.purge = function(gd) {
11731173

11741174
// these get recreated on Plotly.plot anyway, but just to be safe
11751175
// (and to have a record of them...)
1176-
delete gd._tester;
11771176
delete gd._promises;
11781177
delete gd._redrawTimer;
11791178
delete gd.firstscatter;

src/traces/carpet/plot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function plotOne(gd, plotinfo, cd) {
5959
drawGridLines(xa, ya, boundaryLayer, aax, 'a-boundary', aax._boundarylines);
6060
drawGridLines(xa, ya, boundaryLayer, bax, 'b-boundary', bax._boundarylines);
6161

62-
var maxAExtent = drawAxisLabels(gd._tester, xa, ya, trace, t, labelLayer, aax._labels, 'a-label');
63-
var maxBExtent = drawAxisLabels(gd._tester, xa, ya, trace, t, labelLayer, bax._labels, 'b-label');
62+
var maxAExtent = drawAxisLabels(Drawing.tester, xa, ya, trace, t, labelLayer, aax._labels, 'a-label');
63+
var maxBExtent = drawAxisLabels(Drawing.tester, xa, ya, trace, t, labelLayer, bax._labels, 'b-label');
6464

6565
drawAxisTitles(labelLayer, trace, t, xa, ya, maxAExtent, maxBExtent);
6666

test/jasmine/tests/plots_test.js

-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ describe('Test Plots', function() {
428428
expect(gd.undonum).toBeUndefined();
429429
expect(gd.autoplay).toBeUndefined();
430430
expect(gd.changed).toBeUndefined();
431-
expect(gd._tester).toBeUndefined();
432431
expect(gd._promises).toBeUndefined();
433432
expect(gd._redrawTimer).toBeUndefined();
434433
expect(gd.firstscatter).toBeUndefined();

0 commit comments

Comments
 (0)