From 5711e880933876f03178d6ec067a28d7dd4d5c6b Mon Sep 17 00:00:00 2001
From: Morris Jobke <hey@morrisjobke.de>
Date: Tue, 23 Feb 2016 10:47:38 +0100
Subject: [PATCH] Avoids jumping if window is smaller than 300 pixels in height

* divides the area where the scroll should be triggered by 2
* uses the minimum value of the above and 300
---
 apps/files/js/files.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index daf762abb8c..9af9592929a 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -402,9 +402,10 @@ var dragOptions={
 	},
 	drag: function(event, ui) {
 		var currentScrollTop = $("#app-content").scrollTop();
+		var scrollArea = Math.min(Math.floor($(window).innerHeight()/2), 300);
 
-		var bottom = $(window).innerHeight() - 300;
-        	var top = $(window).scrollTop() + 300;
+		var bottom = $(window).innerHeight() - scrollArea;
+		var top = $(window).scrollTop() + scrollArea;
 		if (event.pageY < top){
 			$('html, body').animate({
 				scrollTop: $("#app-content").scrollTop(currentScrollTop-=10)
-- 
GitLab