-
Notifications
You must be signed in to change notification settings - Fork 290
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 column reordering when mouse leaves the browser window. #105
Conversation
this._eventOutToken = EventListener.listen( | ||
this._domNode, | ||
'mouseout', | ||
this.onMouseLeave |
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.
Maybe rename onMouseLeave to onMouseEnd?
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.
Sure!
@@ -141,6 +156,13 @@ class DOMMouseMoveTracker { | |||
} | |||
this._onMoveEnd(); |
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.
Lets explicitly return false here
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.
OK.
@@ -77,11 +88,15 @@ class DOMMouseMoveTracker { | |||
* These releases all of the listeners on document.body. | |||
*/ | |||
releaseMouseMoves() { | |||
if (this._eventMoveToken && this._eventUpToken) { | |||
if (this._eventMoveToken && this._eventUpToken && this._eventLeaveToken) { |
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.
I need to add this.eventOutToken to this list.
this.props.onColumnReorderEndCallback({ | ||
columnBefore, columnAfter, reorderColumn | ||
}); | ||
} | ||
|
||
var onHorizontalScroll = this.props.onHorizontalScroll; |
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.
I don't think we want to run this onHorizontalScroll code here.
Can we just return early if cancelReorder is true?
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.
Good call. I only made sure that we want the stuff above the cancelReorder check, I didn't look below it to see if we want to skip anything.
I'll change the contents of the if block to return early and put the Callback after the if block.
LGTM after one comment is addressed |
Description
Add an onMouseLeave function that handles the mouse leaving the browser window. This function closes all listener functionality related to column reordering and cancels the reorder.
Motivation and Context
#104
How Has This Been Tested?
I tested this manually by reordering columns multiple times, dropping the columns both inside and outside the browser window.
Screenshots (if appropriate):
Types of changes
Checklist: