From 909120ef89a07140d84643e985acb1c3dc675832 Mon Sep 17 00:00:00 2001 From: etienne Date: Mon, 26 Feb 2018 11:21:40 -0500 Subject: [PATCH] make scattergl dragmode relayout replot not recalc ... replot is sufficient since regl push. --- src/plot_api/plot_api.js | 4 ++-- test/jasmine/tests/plot_api_test.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 9aa3f9712ce..838968e2ca5 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -2008,12 +2008,12 @@ function _relayout(gd, aobj) { else flags.plot = true; } else { - if((fullLayout._has('gl2d') || fullLayout._has('regl')) && + if((fullLayout._has('scatter-like') && fullLayout._has('regl')) && (ai === 'dragmode' && (vi === 'lasso' || vi === 'select') && !(vOld === 'lasso' || vOld === 'select')) ) { - flags.calc = true; + flags.plot = true; } else if(valObject) editTypes.update(flags, valObject); else flags.calc = true; diff --git a/test/jasmine/tests/plot_api_test.js b/test/jasmine/tests/plot_api_test.js index 0d52ac76d28..14f61d65a60 100644 --- a/test/jasmine/tests/plot_api_test.js +++ b/test/jasmine/tests/plot_api_test.js @@ -523,7 +523,7 @@ describe('Test plot api', function() { return gd; } - it('should trigger recalc when switching into select or lasso dragmode', function() { + it('should trigger replot (but not recalc) when switching into select or lasso dragmode for scattergl traces', function() { var gd = mock({ data: [{ type: 'scattergl', @@ -541,8 +541,8 @@ describe('Test plot api', function() { expect(subroutines.layoutReplot).not.toHaveBeenCalled(); } - function expectRecalc() { - expect(gd.calcdata).toBeUndefined(); + function expectReplot() { + expect(gd.calcdata).toBeDefined(); expect(subroutines.doModeBar).not.toHaveBeenCalled(); expect(subroutines.layoutReplot).toHaveBeenCalled(); } @@ -551,7 +551,7 @@ describe('Test plot api', function() { expectModeBarOnly(); Plotly.relayout(mock(gd), 'dragmode', 'lasso'); - expectRecalc(); + expectReplot(); Plotly.relayout(mock(gd), 'dragmode', 'select'); expectModeBarOnly(); @@ -563,7 +563,7 @@ describe('Test plot api', function() { expectModeBarOnly(); Plotly.relayout(mock(gd), 'dragmode', 'select'); - expectRecalc(); + expectReplot(); }); });