-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix shift selection after pan #2676
Conversation
src/plots/cartesian/dragbox.js
Outdated
@@ -178,6 +178,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |||
prepSelect(e, startX, startY, dragOptions, dragModeNow); | |||
} else { | |||
dragOptions.clickFn = clickFn; | |||
// clear selection polygon cache (if any) | |||
plotinfo.selection = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be part of clearSelect
? That gets called in all 3 blocks below (directly in the first and third, and in the second it's inside zoomPrep
- looks like these can be simplified anyway) but also in zoomWheel
- does that case have the same bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Good catch. Zoom has the problem.
Working on a fix ⛏️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed and 🔒 in f682fb8
src/plots/cartesian/dragbox.js
Outdated
if(redrawTimer === null) { | ||
clearSelect(zoomlayer); | ||
} | ||
clearSelect(zoomlayer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fixes what I botched in 51c3128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/plots/cartesian/dragbox.js
Outdated
@@ -196,11 +194,18 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |||
} else if(dragModeNow === 'pan') { | |||
dragOptions.moveFn = plotDrag; | |||
dragOptions.doneFn = dragTail; | |||
clearSelect(zoomlayer); | |||
clearAndResetSelect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, every branch here contains clearAndResetSelect
(and this is the only caller of zoomPrep
) so it can be factored out into just one call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, I missed the one in zoomPrep
. Cleaned up in -> 34a0cf7
Fantastic. Really nice tests BTW! 💃 |
Fixes #2669
before:
now:
cc @alexcjohnson