-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Desktop: Fixes #3628: Add scroll offset for dragging notes (ui_update branch) #3651
Desktop: Fixes #3628: Add scroll offset for dragging notes (ui_update branch) #3651
Conversation
The note draging was not taking into account the scroll distance. This caused the notes to be dragged to a different location than the mouse. This scroll offset should fix that issue.
@@ -141,7 +141,7 @@ class NoteListComponent extends React.Component { | |||
} | |||
|
|||
dragTargetNoteIndex_(event:any) { | |||
return Math.abs(Math.round((event.clientY - this.itemListRef.current.offsetTop()) / this.itemHeight)) - 1; | |||
return Math.abs(Math.round((event.clientY - this.itemListRef.current.offsetTop() + this.itemListRef.current.offsetScroll()) / this.itemHeight)); |
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.
Was the - 1
at the end of the dragging notes calculation on purpose?
It is not currently in the dev branch.
It does not line up with the mouse if it is there. It makes the drag location 1 note high.
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.
Yes I've added that as the index somehow was off by 1 at some point while I was testing. But maybe it was some other issue, or your change fixes it properly. I'll give it a try to be sure.
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, I'm not sure which way it needs to be.
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.
How's this look?
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 will test this change once I get back to the UI update, which should be relatively soon.
For some reason, I can't link the issue #3628 to this pull request. |
The fix was good, thanks @DarinDev1000! |
Thanks |
Fixes #3628
The note dragging was not taking into account the scroll distance.
This caused the notes to be dragged to a different location than the mouse.
This scroll offset should fix that issue.
This fix was moved to ui_update branch instead of dev branch.
Original pull request on dev branch