Skip to content

Commit

Permalink
Merge pull request #3575 from plotly/scattergl-text-select-then-pan-bug
Browse files Browse the repository at this point in the history
Call styleTextSelection only on hasText traces
  • Loading branch information
etpinard authored Feb 25, 2019
2 parents 2da4e44 + 98fadff commit 13b925c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/traces/scattergl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ function plot(gd, subplot, cdata) {

if(scene.glText) {
cdata.forEach(function(cdscatter) {
if(cdscatter && cdscatter[0] && cdscatter[0].trace) {
var trace = ((cdscatter || [])[0] || {}).trace || {};
if(subTypes.hasText(trace)) {
styleTextSelection(cdscatter);
}
});
Expand Down
5 changes: 4 additions & 1 deletion test/jasmine/tests/gl2d_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,9 @@ describe('Test gl2d plots', function() {
var trace = {
x: [2],
y: [1],
text: ['a'],
type: 'scattergl',
mode: 'markers',
mode: 'markers+text',
marker: {color: 'red'}
};

Expand All @@ -947,6 +948,8 @@ describe('Test gl2d plots', function() {
expect(scene.unselectBatch).toEqual([[]]);
expect(scene.markerOptions.length).toBe(2);
expect(scene.markerOptions[1].color).toEqual(new Uint8Array([255, 0, 0, 255]));
expect(scene.textOptions.length).toBe(2);
expect(scene.textOptions[1].color).toEqual('#444');
expect(scene.scatter2d.draw).toHaveBeenCalled();

return Plotly.restyle(gd, 'selectedpoints', null);
Expand Down

0 comments on commit 13b925c

Please sign in to comment.