Use proper scroll container when dragging files

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-02-20 10:22:07 +01:00
parent 10ae7af87f
commit c8ce7ebae2
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 5 additions and 6 deletions

View File

@ -455,21 +455,20 @@ var dragOptions={
$('.crumbmenu').removeClass('canDropChildren');
},
drag: function(event, ui) {
var scrollingArea = FileList.$container;
var scrollingArea = window;
var currentScrollTop = $(scrollingArea).scrollTop();
var scrollArea = Math.min(Math.floor($(window).innerHeight() / 2), 100);
var bottom = $(window).innerHeight() - scrollArea;
var top = $(window).scrollTop() + scrollArea;
if (event.pageY < top) {
$('html, body').animate({
scrollTop: $(scrollingArea).scrollTop(currentScrollTop - 10)
$(scrollingArea).animate({
scrollTop: currentScrollTop - 10
}, 400);
} else if (event.pageY > bottom) {
$('html, body').animate({
scrollTop: $(scrollingArea).scrollTop(currentScrollTop + 10)
$(scrollingArea).animate({
scrollTop: currentScrollTop + 10
}, 400);
}