-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add scrolling when dragging files. Fixes #12329 #22576
Conversation
By analyzing the blame information on this pull request, we identified @PVince81, @MorrisJobke and @butonic to be potential reviewers |
Seems like I closed it by accident |
I expect it to only scroll when I reach the top item (or maybe the second top item), not the middle of the page. |
Better or worse now @PVince81 ? |
Looks good now 👍 However it doesn't work on the public link page, might need a separate fix ? |
var top = $(window).scrollTop() + scrollArea; | ||
if (event.pageY < top){ | ||
|
||
scrollTop: $("#app-content").scrollTop(currentScrollTop-=10); |
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 looks like broken syntax.
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.
@MorrisJobke oh damn. Not sure what I was thinking there. Just quickly edited the file to match my own on the githubs browser editor and messed up. I'll fix that asap
@PVince81 Good catch. It doesn't work because the public link page uses #content-wrapper id and the files app page uses #app-content Easy fix would be to add css class to both of them and then select based on that? Should I do that? |
@ErikPel you can also use |
@PVince81 Did not know that existed. Fixed now. |
var top = $(window).scrollTop() + scrollArea; | ||
if (event.pageY < top){ | ||
|
||
$(scrollingArea).scrollTop(currentScrollTop-=10); |
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 also just noticed this. Please don't decrement/increment inline. Put currentScrollTip -= 10;
on a separate row if needed, for better readability.
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.
@PVince81 not sure if I understood you correctly. Changed it. Was that what you meant?
@PVince81 makes sense. Added. |
if (event.pageY < top){ | ||
|
||
$(scrollingArea).scrollTop( | ||
currentScrollTop -= 10 |
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.
No. Here you are still doing two things at the same time.
Please split it to two rows:
- row 1 decrements
currentScrollTop
- row 2 sets it to the
scrollTop(currentScrollTop)
function.
Also one thing I don't understand is why you are using -=
here instead of just -
?
You are not reusing currentScrollTop
later on, so no need to update the variable's value.
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.
if (event.pageY < top){
currentScrollTop -= 10
$(scrollingArea).scrollTop(currentScrollTop);
}
else if (event.pageY > bottom) {
currentScrollTop += 10
$(scrollingArea).scrollTop(currentScrollTop);
}
Is this what you mean? @PVince81
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.
But then comes my second question, why increment/decrement currentScrollTop
if you don't use it later ?
This would be enough:
if (event.pageY < top){
$(scrollingArea).scrollTop(currentScrollTop - 10);
}
else if (event.pageY > bottom) {
$(scrollingArea).scrollTop(currentScrollTop + 10);
}
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.
@PVince81 I really have no idea. Guess I wasn't thinking.
Changed it now
Yeah seems like it. @PVince81 |
Agreed |
@ErikPel any chance to finish this for 9.1 ? |
Ah, right. I didn't see that you added a commit. I'll retest it later then. Thanks! |
* divides the area where the scroll should be triggered by 2 * uses the minimum value of the above and 300
I tested this again on a rebased version of this (I pushed this - sorry for highjacking, but this was 1,5k commits behind master:P) Still works 👍 |
2e4c033
to
5dbb549
Compare
Looks good now 👍 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This should work but the numbers probably need tweaking so feedback is much appreciated.
Fixes #12329