Merge pull request #4201 from mfilser/fix_dragging_scroll_vertically

Dragging minicards scrolls now vertically at the end of the screen
This commit is contained in:
Lauri Ojansivu 2021-11-29 23:22:48 +02:00 committed by GitHub
commit c1eb175ab8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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