diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-05-20 16:19:01 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-20 16:19:01 +0200 |
commit | 59a85a4c76b80658d9373e3acf4f71b872b244a0 (patch) | |
tree | e405600b3531a340bb422738739eea351cb064c9 /apps | |
parent | 94ad54ec9b96d41a614fbbad4a97b34c41a6901f (diff) | |
parent | 5dbb549bbea8e555543dd50ca7688d8486057f5f (diff) | |
download | nextcloud-server-59a85a4c76b80658d9373e3acf4f71b872b244a0.tar.gz nextcloud-server-59a85a4c76b80658d9373e3acf4f71b872b244a0.zip |
Merge pull request #22576 from owncloud/folder_scroll_fix
Add scrolling when dragging files. Fixes #12329
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/files.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 3b70e283749..8542bd50476 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -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 |