Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ffe1700

Browse files
committed
make sure scroll clears selection outline not just the 1st time
1 parent 7784a10 commit ffe1700

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/plots/cartesian/dragbox.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
393393
return;
394394
}
395395

396-
if(redrawTimer === null) {
397-
clearSelect(zoomlayer);
398-
}
396+
clearSelect(zoomlayer);
399397

400398
// If a transition is in progress, then disable any behavior:
401399
if(gd._transitioningWithDuration) {

test/jasmine/tests/select_test.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,16 +539,27 @@ describe('@flaky Test select box and lasso in general:', function() {
539539
mockCopy.layout.dragmode = 'select';
540540
mockCopy.config = {scrollZoom: true};
541541

542-
Plotly.plot(gd, mockCopy).then(function() {
542+
function _drag() {
543543
resetEvents(gd);
544544
drag(selectPath);
545545
return selectedPromise;
546-
})
547-
.then(function() {
546+
}
547+
548+
function _scroll() {
548549
mouseEvent('mousemove', selectPath[0][0], selectPath[0][1]);
549550
mouseEvent('scroll', selectPath[0][0], selectPath[0][1], {deltaX: 0, deltaY: -20});
551+
}
552+
553+
Plotly.plot(gd, mockCopy)
554+
.then(_drag)
555+
.then(_scroll)
556+
.then(function() {
557+
assertSelectionNodes(0, 0);
550558
})
559+
.then(_drag)
560+
.then(_scroll)
551561
.then(function() {
562+
// make sure it works the 2nd time aroung
552563
assertSelectionNodes(0, 0);
553564
})
554565
.catch(failTest)

0 commit comments

Comments
 (0)