Skip to content

Commit 8d0cac5

Browse files
committed
use styleOnSelect for scatter[polar]gl and splom
... instead of 'style', for consistency. Other _module.style in the traces/ get called during Plots.style, something we don't want to do in regl traces, to avoid double-drawing.
1 parent 3574ece commit 8d0cac5

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

src/traces/scattergl/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,7 @@ function selectPoints(searchInfo, selectionTester) {
893893
return selection;
894894
}
895895

896-
function style(gd, cds) {
897-
if(!cds) return;
898-
896+
function styleOnSelect(gd, cds) {
899897
var stash = cds[0][0].t;
900898
var scene = stash._scene;
901899

@@ -957,7 +955,7 @@ module.exports = {
957955
calc: calc,
958956
plot: plot,
959957
hoverPoints: hoverPoints,
960-
style: style,
958+
styleOnSelect: styleOnSelect,
961959
selectPoints: selectPoints,
962960

963961
sceneOptions: sceneOptions,

src/traces/scatterpolargl/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ module.exports = {
183183
calc: calc,
184184
plot: plot,
185185
hoverPoints: hoverPoints,
186-
style: ScatterGl.style,
186+
styleOnSelect: ScatterGl.styleOnSelect,
187187
selectPoints: ScatterGl.selectPoints,
188188

189189
meta: {

src/traces/splom/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,7 @@ function selectPoints(searchInfo, selectionTester) {
424424
return selection;
425425
}
426426

427-
function style(gd, cds) {
428-
if(!cds) return;
429-
427+
function styleOnSelect(gd, cds) {
430428
var fullLayout = gd._fullLayout;
431429
var cd0 = cds[0];
432430
var scene0 = fullLayout._splomScenes[cd0[0].trace.uid];
@@ -479,7 +477,7 @@ module.exports = {
479477
plot: plot,
480478
hoverPoints: hoverPoints,
481479
selectPoints: selectPoints,
482-
style: style,
480+
styleOnSelect: styleOnSelect,
483481

484482
meta: {
485483
description: [

test/jasmine/tests/splom_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,20 +1087,20 @@ describe('Test splom select:', function() {
10871087

10881088
Plotly.newPlot(gd, fig).then(function() {
10891089
// 'scattergl' trace module
1090-
spyOn(gd._fullLayout._modules[0], 'style').and.callFake(function() {
1090+
spyOn(gd._fullLayout._modules[0], 'styleOnSelect').and.callFake(function() {
10911091
cnt++;
10921092
scatterGlCnt = cnt;
10931093
});
10941094
// 'splom' trace module
1095-
spyOn(gd._fullLayout._modules[1], 'style').and.callFake(function() {
1095+
spyOn(gd._fullLayout._modules[1], 'styleOnSelect').and.callFake(function() {
10961096
cnt++;
10971097
splomCnt = cnt;
10981098
});
10991099
})
11001100
.then(function() { return _select([[20, 395], [195, 205]]); })
11011101
.then(function() {
1102-
expect(gd._fullLayout._modules[0].style).toHaveBeenCalledTimes(1);
1103-
expect(gd._fullLayout._modules[1].style).toHaveBeenCalledTimes(1);
1102+
expect(gd._fullLayout._modules[0].styleOnSelect).toHaveBeenCalledTimes(1);
1103+
expect(gd._fullLayout._modules[1].styleOnSelect).toHaveBeenCalledTimes(1);
11041104

11051105
expect(cnt).toBe(2);
11061106
expect(splomCnt).toBe(1, 'splom redraw before scattergl');

0 commit comments

Comments
 (0)