Card drag/drop scrolls now the list at top/bottom

This commit is contained in:
Martin Filser 2021-10-25 11:26:02 +02:00
parent 75af42cd8c
commit 292e43466e
6 changed files with 49 additions and 3 deletions

View file

@ -1,3 +1,5 @@
require('/client/lib/jquery-ui.js')
const { calculateIndex } = Utils;
BlazeComponent.extendComponent({
@ -114,6 +116,20 @@ BlazeComponent.extendComponent({
}
boardComponent.setIsDragging(false);
},
sort(event, ui) {
const $boardCanvas = $('.board-canvas');
const boardCanvas = $boardCanvas[0];
if (event.pageX < 10)
{ // scroll to the left
boardCanvas.scrollLeft -= 15;
ui.helper[0].offsetLeft -= 15;
}
if (event.pageX > boardCanvas.offsetWidth - 10)
{ // scroll to the right
boardCanvas.scrollLeft += 15;
}
},
});
this.autorun(() => {