Skip to content
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

Merged
merged 6 commits into from
Jan 16, 2017

Conversation

sisyphean2
Copy link
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

this._eventOutToken = EventListener.listen(
this._domNode,
'mouseout',
this.onMouseLeave
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor Author

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.

@KamranAsif KamranAsif changed the title BCReorder: Fix column reordering when mouse leaves the browser window. Fix column reordering when mouse leaves the browser window. Jan 12, 2017
this.props.onColumnReorderEndCallback({
columnBefore, columnAfter, reorderColumn
});
}

var onHorizontalScroll = this.props.onHorizontalScroll;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@KamranAsif
Copy link
Contributor

LGTM after one comment is addressed

@KamranAsif KamranAsif added the bug label Jan 12, 2017
@KamranAsif KamranAsif merged commit dfebfc2 into schrodinger:master Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants