@@ -449,7 +449,6 @@ var dragOptions={
449449	revert : 'invalid' , 
450450	revertDuration : 300 , 
451451	opacity : 0.7 , 
452- 	appendTo : 'body' , 
453452	cursorAt : {  left : 24 ,  top : 18  } , 
454453	helper : createDragShadow , 
455454	cursor : 'move' , 
@@ -482,23 +481,26 @@ var dragOptions={
482481		$ ( '.crumbmenu' ) . removeClass ( 'canDropChildren' ) ; 
483482	} , 
484483	drag : function ( event ,  ui )  { 
485- 		var  scrollingArea  =  FileList . $container ; 
486- 		var  currentScrollTop  =  $ ( scrollingArea ) . scrollTop ( ) ; 
487- 		var  scrollArea  =  Math . min ( Math . floor ( $ ( window ) . innerHeight ( )  /  2 ) ,  100 ) ; 
488- 
489- 		var  bottom  =  $ ( window ) . innerHeight ( )  -  scrollArea ; 
490- 		var  top  =  $ ( window ) . scrollTop ( )  +  scrollArea ; 
491- 		if  ( event . pageY  <  top )  { 
492- 			$ ( scrollingArea ) . animate ( { 
493- 				scrollTop : currentScrollTop  -  10 
494- 			} ,  400 ) ; 
495- 
496- 		}  else  if  ( event . pageY  >  bottom )  { 
497- 			$ ( scrollingArea ) . animate ( { 
498- 				scrollTop : currentScrollTop  +  10 
499- 			} ,  400 ) ; 
500- 		} 
484+ 		/** @type  {JQuery<HTMLDivElement> } */ 
485+ 		const  scrollingArea  =  FileList . $container ; 
486+ 
487+ 		// Get the top and bottom scroll trigger y positions 
488+ 		const  containerHeight  =  scrollingArea . innerHeight ( )  ??  0 
489+ 		const  scrollTriggerArea  =  Math . min ( Math . floor ( containerHeight  /  2 ) ,  100 ) ; 
490+ 		const  bottomTriggerY  =  containerHeight  -  scrollTriggerArea ; 
491+ 		const  topTriggerY  =  scrollTriggerArea ; 
492+ 
493+ 		// Get the cursor position relative to the container 
494+ 		const  containerOffset  =  scrollingArea . offset ( )  ??  { left : 0 ,  top : 0 } 
495+ 		const  cursorPositionY  =  event . pageY  -  containerOffset . top 
501496
497+ 		const  currentScrollTop  =  scrollingArea . scrollTop ( )  ??  0 
498+ 
499+ 		if  ( cursorPositionY  <  topTriggerY )  { 
500+ 			scrollingArea . scrollTop ( currentScrollTop  -  10 ) 
501+ 		}  else  if  ( cursorPositionY  >  bottomTriggerY )  { 
502+ 			scrollingArea . scrollTop ( currentScrollTop  +  10 ) 
503+ 		} 
502504	} 
503505} ; 
504506// sane browsers support using the distance option 
0 commit comments