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

Add scrolling when dragging files. Fixes #12329 #22576

Merged
merged 10 commits into from
May 20, 2016
Merged

Conversation

ErikPel
Copy link
Contributor

@ErikPel ErikPel commented Feb 22, 2016

This should work but the numbers probably need tweaking so feedback is much appreciated.

Fixes #12329

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @PVince81, @MorrisJobke and @butonic to be potential reviewers

@ErikPel
Copy link
Contributor Author

ErikPel commented Feb 22, 2016

Seems like I closed it by accident

@DeepDiver1975 DeepDiver1975 added this to the 9.0-current milestone Feb 22, 2016
@MorrisJobke
Copy link
Contributor

@ErikPel Awesome! I added a tiny change to fix an issue with small screen (below 300 pixel in height - it was jumping). And now everything works like a charm.

Tested in Safari, Firefox, Chrome, IE11, Edge. 👍

@PVince81 @owncloud/designers Check this out! :)

@MorrisJobke
Copy link
Contributor

cc @dttpy @SergioBertolinSG

@PVince81
Copy link
Contributor

It's too sensitive and scrolls too early for me in Chrome:
2016-02-23 11-02-22

@PVince81
Copy link
Contributor

I expect it to only scroll when I reach the top item (or maybe the second top item), not the middle of the page.

@ErikPel
Copy link
Contributor Author

ErikPel commented Feb 23, 2016

Better or worse now @PVince81 ?
Also removed the jquery animate functions. Feels more responsive now. Not sure if others agree though

@PVince81
Copy link
Contributor

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

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.

Copy link
Contributor Author

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

@ErikPel
Copy link
Contributor Author

ErikPel commented Feb 23, 2016

@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?

@PVince81
Copy link
Contributor

@ErikPel you can also use FileList.$container to find out which element is used for scrolling

@ErikPel
Copy link
Contributor Author

ErikPel commented Feb 23, 2016

@PVince81 Did not know that existed. Fixed now.

var top = $(window).scrollTop() + scrollArea;
if (event.pageY < top){

$(scrollingArea).scrollTop(currentScrollTop-=10);
Copy link
Contributor

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.

Copy link
Contributor Author

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?

@ErikPel
Copy link
Contributor Author

ErikPel commented Feb 23, 2016

@PVince81 makes sense. Added.

if (event.pageY < top){

$(scrollingArea).scrollTop(
currentScrollTop -= 10
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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);
        }

Copy link
Contributor Author

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

@PVince81
Copy link
Contributor

Seems worse now, maybe the scroll container is still the wrong one. No idea why:
2016-02-23 15-48-00

@ErikPel
Copy link
Contributor Author

ErikPel commented Feb 23, 2016

Yeah seems like it. @PVince81
Seems like those animations were neccessary after all because they seem to fix the problem (or am I imagining things?).

@jancborchardt
Copy link
Member

@ErikPel @PVince81 I would move this to 9.1 since we’re way past feature freeze and this has too much potential for breakage.

@jancborchardt jancborchardt modified the milestones: 9.1-next, 9.0-current Feb 25, 2016
@PVince81
Copy link
Contributor

Agreed

@PVince81
Copy link
Contributor

@ErikPel any chance to finish this for 9.1 ?

@ErikPel
Copy link
Contributor Author

ErikPel commented May 13, 2016

@PVince81 I'm really busy with work right now but I can take look if you tell me what needs to be fixed.
If I remember correctly 2e4c033 was never tested since this was moved to 9.1.

@PVince81
Copy link
Contributor

Ah, right. I didn't see that you added a commit.
In general it is good practice to post a message every time you make a change so people get notifications 😄

I'll retest it later then. Thanks!

@MorrisJobke
Copy link
Contributor

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 👍

@PVince81
Copy link
Contributor

Looks good now 👍
Note that when it scrolls down sometimes my nav bar shifts a little bit, but no biggie.

@PVince81 PVince81 merged commit 59a85a4 into master May 20, 2016
@PVince81 PVince81 deleted the folder_scroll_fix branch May 20, 2016 14:19
@lock
Copy link

lock bot commented Aug 5, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drag and drop a file into a subfolder not possible / doesn't autoscroll
7 participants