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(() => {

17
client/lib/jquery-ui.js vendored Normal file
View file

@ -0,0 +1,17 @@
// https://bugs.jqueryui.com/ticket/15020
// required for sortable
require('jquery-ui/ui/widget')
require('jquery-ui/ui/scroll-parent')
require('jquery-ui/ui/data')
require('jquery-ui/ui/widgets/mouse')
require('jquery-ui/ui/ie')
require('jquery-ui/ui/widgets/sortable')
// required for draggable
require('jquery-ui/ui/plugin')
require('jquery-ui/ui/safe-active-element')
require('jquery-ui/ui/safe-blur')
require('jquery-ui/ui/widgets/draggable')
// everything already required for droppable
require('jquery-ui/ui/widgets/droppable')