Skip to content

Commit 51c3128

Browse files
committed
clear select outlines on 1st scroll event on cartesian subplots
- see #2343 (comment) for more details on this issue.
1 parent 3d4befc commit 51c3128

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/plots/cartesian/dragbox.js

+4
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
358358
return;
359359
}
360360

361+
if(redrawTimer === null) {
362+
clearSelect(zoomlayer);
363+
}
364+
361365
// If a transition is in progress, then disable any behavior:
362366
if(gd._transitioningWithDuration) {
363367
e.preventDefault();

test/jasmine/tests/select_test.js

+22
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,28 @@ describe('Test select box and lasso in general:', function() {
530530
.catch(fail)
531531
.then(done);
532532
});
533+
534+
it('scroll zoom should clear selection regions', function(done) {
535+
var gd = createGraphDiv();
536+
var mockCopy = Lib.extendDeep({}, mock);
537+
mockCopy.layout.dragmode = 'select';
538+
mockCopy.config = {scrollZoom: true};
539+
540+
Plotly.plot(gd, mockCopy).then(function() {
541+
resetEvents(gd);
542+
drag(selectPath);
543+
return selectedPromise;
544+
})
545+
.then(function() {
546+
mouseEvent('mousemove', selectPath[0][0], selectPath[0][1]);
547+
mouseEvent('scroll', selectPath[0][0], selectPath[0][1], {deltaX: 0, deltaY: -20});
548+
})
549+
.then(function() {
550+
assertSelectionNodes(0, 0);
551+
})
552+
.catch(fail)
553+
.then(done);
554+
});
533555
});
534556

535557
describe('Test select box and lasso per trace:', function() {

0 commit comments

Comments
 (0)