Skip to content

Commit a78521c

Browse files
committed
handle a few polar-only cases:
- Plots.redrawText and Snapshot redraw work with every plot type except polar - continue if polar trace is detected in main supply default trace loop - don't assign _hasPolar (it didn't have to correct value anyway)
1 parent a48d071 commit a78521c

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/plots/plots.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,18 @@ plots.getSubplotData = function getSubplotData(data, type, subplotId) {
259259
// then wait a little, then draw it again
260260
plots.redrawText = function(gd) {
261261

262-
// doesn't work presently (and not needed) for polar or 3d
263-
if(gd._fullLayout._hasGL3D || (gd.data && gd.data[0] && gd.data[0].r)) {
264-
return;
265-
}
262+
// do not work if polar is present
263+
if((gd.data && gd.data[0] && gd.data[0].r)) return;
266264

267265
return new Promise(function(resolve) {
268266
setTimeout(function() {
269267
Plotly.Annotations.drawAll(gd);
270268
Plotly.Legend.draw(gd);
271-
(gd.calcdata||[]).forEach(function(d) {
272-
if(d[0]&&d[0].t&&d[0].t.cb) d[0].t.cb();
269+
270+
(gd.calcdata || []).forEach(function(d) {
271+
if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb();
273272
});
273+
274274
resolve(plots.previousPromises(gd));
275275
},300);
276276
});
@@ -476,7 +476,7 @@ plots.supplyDefaults = function(gd) {
476476
newFullData.push(fullTrace);
477477

478478
// detect polar
479-
if('r' in fullTrace) newFullLayout._hasPolar = true;
479+
if('r' in newData[i]) continue;
480480

481481
_module = fullTrace._module;
482482
if(!_module) continue;

src/snapshot/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@
1010
'use strict';
1111

1212
function getDelay(fullLayout) {
13-
return (fullLayout._hasGL3D || fullLayout._hasGL2D) ? 500 : 0;
13+
14+
// polar clears fullLayout._has for some reason
15+
if(!fullLayout._has) return 0;
16+
17+
// maybe we should add a 'gl' (and 'svg') layoutCategory ??
18+
return (fullLayout._has('gl3d')|| fullLayout._has('gl2d')) ? 500 : 0;
1419
}
1520

1621
function getRedrawFunc(gd) {
17-
return function() {
18-
var fullLayout = gd._fullLayout;
1922

20-
// doesn't work presently (and not needed) for polar or gl
21-
if(fullLayout._hasGL3D || fullLayout._hasGL2D ||
22-
(gd.data && gd.data[0] && gd.data[0].r)
23-
) return;
23+
// do not work if polar is present
24+
if((gd.data && gd.data[0] && gd.data[0].r)) return;
2425

26+
return function() {
2527
(gd.calcdata || []).forEach(function(d) {
2628
if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb();
2729
});

0 commit comments

Comments
 (0)