Merge pull request #22576 from owncloud/folder_scroll_fix

Add scrolling when dragging files. Fixes #12329
This commit is contained in:
Vincent Petry 2016-05-20 16:19:01 +02:00
commit 59a85a4c76
1 changed files with 21 additions and 0 deletions

View File

@ -385,6 +385,7 @@ var dragOptions={
cursorAt: { left: 24, top: 18 },
helper: createDragShadow,
cursor: 'move',
start: function(event, ui){
var $selectedFiles = $('td.filename input:checkbox:checked');
if (!$selectedFiles.length) {
@ -398,6 +399,26 @@ var dragOptions={
$selectedFiles = $(this);
}
$selectedFiles.closest('tr').fadeTo(250, 1).removeClass('dragging');
},
drag: function(event, ui) {
var scrollingArea = FileList.$container;
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)
}, 400);
} else if (event.pageY > bottom) {
$('html, body').animate({
scrollTop: $(scrollingArea).scrollTop(currentScrollTop + 10)
}, 400);
}
}
};
// sane browsers support using the distance option