Skip to content

Commit ec57a42

Browse files
committed
fix radial drag when scatterpolar & scatterpolargl are on same subplot
1 parent d3b3615 commit ec57a42

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/plots/polar/polar.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,13 @@ proto.updateRadialDrag = function(fullLayout, polarLayout) {
993993
var moduleCalcDataVisible = Lib.filterVisible(moduleCalcData);
994994
var _module = moduleCalcData[0][0].trace._module;
995995
var polarLayoutNow = gd._fullLayout[_this.id];
996+
var isGL = Registry.traceIs(k, 'gl');
997+
998+
if(isGL && _this._scene) _this._scene.clear();
996999

997-
if(_this._scene) _this._scene.clear();
9981000
_module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow);
9991001

1000-
if(!Registry.traceIs(k, 'gl')) {
1002+
if(!isGL) {
10011003
for(var i = 0; i < moduleCalcDataVisible.length; i++) {
10021004
_module.style(gd, moduleCalcDataVisible[i]);
10031005
}

test/jasmine/tests/polar_test.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,13 @@ describe('Test polar interactions:', function() {
11221122
patch: function(fig) {
11231123
fig.data.forEach(function(trace) { trace.mode = 'markers+lines'; });
11241124
}
1125+
}, {
1126+
desc: 'gl and non-gl on same subplot case',
1127+
patch: function(fig) {
1128+
fig.data.forEach(function(trace, i) {
1129+
trace.type = (i % 2) ? 'scatterpolar' : 'scatterpolargl';
1130+
});
1131+
}
11251132
}];
11261133

11271134
specs.forEach(function(s) {
@@ -1136,7 +1143,9 @@ describe('Test polar interactions:', function() {
11361143
fig.layout.margin = {l: 50, t: 50, b: 50, r: 50};
11371144

11381145
if(s.patch) s.patch(fig);
1139-
nTraces = fig.data.length;
1146+
nTraces = fig.data.reduce(function(acc, trace) {
1147+
return (trace.type === 'scatterpolargl') ? ++acc : acc;
1148+
}, 0);
11401149

11411150
Plotly.newPlot(gd, fig).then(function() {
11421151
scene = gd._fullLayout.polar._subplot._scene;

0 commit comments

Comments
 (0)