8000 Fix scatterternary lasso/select drag modes by etpinard · Pull Request #1831 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Fix scatterternary lasso/select drag modes #1831

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 5 commits into from
Jun 28, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
add select/lasso for scattercarpet traces
  • Loading branch information
etpinard committed Jun 28, 2017
commit 5a48568850ccf0dc119c7bbd3de0a7719bcdf404
40 changes: 40 additions & 0 deletions test/jasmine/tests/select_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,44 @@ describe('select box and lasso', function() {
.catch(fail)
.then(done);
});

it('should work on scattercarpet traces', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/scattercarpet'));
var gd = createGraphDiv();
var pts = [];

fig.layout.dragmode = 'select';

function assertPoints(expected) {
expect(pts.length).toBe(expected.length, 'selected points length');

pts.forEach(function(p, i) {
var e = expected[i];
expect(p.a).toBe(e.a, 'selected pt a val');
expect(p.b).toBe(e.b, 'selected pt b val');
});
pts = [];
}

Plotly.plot(gd, fig).then(function() {
gd.on('plotly_selected', function(data) {
pts = data.points;
});

assertSelectionNodes(0, 0);
drag([[300, 200], [400, 250]]);
assertSelectionNodes(0, 2);
assertPoints([{ a: 0.2, b: 1.5 }]);

return Plotly.relayout(gd, 'dragmode', 'lasso');
})
.then(function() {
assertSelectionNodes(0, 0);
drag([[300, 200], [400, 200], [400, 250], [300, 250], [300, 200]]);
assertSelectionNodes(0, 2);
assertPoints([{ a: 0.2, b: 1.5 }]);
})
.catch(fail)
.then(done);
});
});
0