Browse Source

Merge pull request #4201 from mfilser/fix_dragging_scroll_vertically

Dragging minicards scrolls now vertically at the end of the screen
Lauri Ojansivu 3 years ago
parent
commit
c1eb175ab8
1 changed files with 3 additions and 3 deletions
  1. 3 3
      client/components/lists/list.js

+ 3 - 3
client/components/lists/list.js

@@ -134,7 +134,7 @@ BlazeComponent.extendComponent({
         }
         if (
           event.pageY > boardCanvas.offsetHeight - 10 &&
-          boardCanvas.scrollTop < $boardCanvas.data('scrollTopMax') // don't scroll more than possible
+          event.pageY + boardCanvas.scrollTop < $boardCanvas.data('scrollTopMax') // don't scroll more than possible
         )
         { // scroll to the bottom
           boardCanvas.scrollTop += 15;
@@ -148,8 +148,8 @@ BlazeComponent.extendComponent({
         const $boardCanvas = $('.board-canvas');
         const  boardCanvas = $boardCanvas[0];
         // scrollTopMax and scrollLeftMax only available at Firefox (https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTopMax)
-        // https://stackoverflow.com/questions/12965296/how-to-get-maximum-document-scrolltop-value/12965383#12965383
-        $boardCanvas.data('scrollTopMax', $(document).height() - $(window).height());
+        // https://www.it-swarm.com.de/de/javascript/so-erhalten-sie-den-maximalen-dokument-scrolltop-wert/1069126844/
+        $boardCanvas.data('scrollTopMax', boardCanvas.scrollHeight - boardCanvas.clientTop);
         // https://stackoverflow.com/questions/5138373/how-do-i-get-the-max-value-of-scrollleft/5704386#5704386
         $boardCanvas.data('scrollLeftMax', boardCanvas.scrollWidth - boardCanvas.clientWidth);
       },