8000 Fix scattergl selection by dy · Pull Request #2267 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content
Closed
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
"polybooljs": "^1.2.0",
"regl": "^1.3.1",
"regl-error2d": "^2.0.3",
"regl-line2d": "^2.1.0",
"regl-scatter2d": "^2.1.9",
"regl-line2d": "^2.1.2",
"regl-scatter2d": "^2.1.11",
"right-now": "^1.0.0",
"robust-orientation": "^1.1.3",
"sane-topojson": "^2.0.0",
Expand Down
54 changes: 52 additions & 2 deletions test/jasmine/tests/gl_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ describe('Test gl2d plots', function() {
var mock = require('@mocks/gl2d_10.json');

beforeEach(function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 3000;
gd = createGraphDiv();
});

Expand All @@ -1462,6 +1462,26 @@ describe('Test gl2d plots', function() {
return drag(node, dx, dy, null, p0[0], p0[1]);
}

function select(path) {
return new Promise(function(resolve) {
gd.once('plotly_selected', resolve);

var len = path.length;

// do selection
Lib.clearThrottle();
mouseEvent('mousemove', path[0][0], path[0][1]);
mouseEvent('mousedown', path[0][0], path[0][1]);

path.slice(1, len).forEach(function(pt) {
Lib.clearThrottle();
mouseEvent('mousemove', pt[0], pt[1]);
});

mouseEvent('mouseup', path[len - 1][0], path[len - 1][1]);
});
}

it('should respond to drag interactions', function(done) {
var _mock = Lib.extendDeep({}, mock);

Expand Down Expand Up @@ -1562,7 +1582,7 @@ describe('Test gl2d plots', function() {
.then(done);
});

it('@noCI should be able to toggle visibility', function(done) {
it('should be able to toggle visibility', function(done) {
var _mock = Lib.extendDeep({}, mock);

Plotly.plot(gd, _mock)
Expand Down Expand Up @@ -1592,6 +1612,36 @@ describe('Test gl2d plots', function() {
.then(done);
});

it('should display selection of big number of points', function(done) {
// generate large number of points
var x = [], y = [], n = 2e2, N = n * n;
for(var i = 0; i < N; i++) {
x.push((i % n) / n);
y.push(i / N);
}

var mock = {
data: [{
x: x, y: y, type: 'scattergl', mode: 'markers'
}],
layout: {
dragmode: 'select'
}
};

Plotly.plot(gd, mock)
.then(delay(1000))
.then(select([[160, 100], [180, 100]]))
.then(delay(1000))
.then(function() {
expect(readPixel(gd.querySelector('.gl-canvas-context'), 168, 100)[3]).toBe(0);
expect(readPixel(gd.querySelector('.gl-canvas-context'), 158, 100)[3]).not.toBe(0);
expect(readPixel(gd.querySelector('.gl-canvas-focus'), 168, 100)[3]).not.toBe(0);
})
.catch(fail)
.then(done);
});

it('should be able to toggle from svg to gl', function(done) {
Plotly.plot(gd, [{
y: [1, 2, 1],
Expand Down
0