Skip to content

Clear selection outline during 'axrange' relayout calls #3577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var connectColorbar = require('../components/colorbar/connect');
var initInteractions = require('../plots/cartesian/graph_interact').initInteractions;
var xmlnsNamespaces = require('../constants/xmlns_namespaces');
var svgTextUtils = require('../lib/svg_text_utils');
var clearSelect = require('../plots/cartesian/select').clearSelect;

var dfltConfig = require('./plot_config').dfltConfig;
var manageArrays = require('./manage_arrays');
Expand Down Expand Up @@ -2001,7 +2002,13 @@ function addAxRangeSequence(seq, rangesAltered) {
return Axes.draw(gd, 'redraw');
};

var _clearSelect = function(gd) {
var zoomlayer = gd._fullLayout._zoomlayer;
if(zoomlayer) clearSelect(zoomlayer);
};

seq.push(
_clearSelect,
subroutines.doAutoRangeAndConstraints,
drawAxes,
subroutines.drawData,
Expand Down
22 changes: 22 additions & 0 deletions test/jasmine/tests/select_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ describe('Test select box and lasso in general:', function() {
.then(done);
});

it('@flaky should have their selection outlines cleared during *axrange* relayout calls', function(done) {
var gd = createGraphDiv();
var fig = Lib.extendDeep({}, mock);
fig.layout.dragmode = 'select';

function _drag() {
resetEvents(gd);
drag(selectPath);
return selectedPromise;
}

Plotly.plot(gd, fig)
.then(_drag)
.then(function() { assertSelectionNodes(0, 2, 'after drag 1'); })
.then(function() { return Plotly.relayout(gd, 'xaxis.range', [-5, 5]); })
.then(function() { assertSelectionNodes(0, 0, 'after axrange relayout'); })
.then(_drag)
.then(function() { assertSelectionNodes(0, 2, 'after drag 2'); })
.catch(failTest)
.then(done);
});

it('@flaky should select the right data with the corresponding select direction', function(done) {

var gd = createGraphDiv();
Expand Down