2017-08-17 22:00:37 +05:30
|
|
|
/* global DocumentTouch */
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
import sortableConfig from '~/sortable/sortable_config';
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export function sortableStart() {
|
2017-08-17 22:00:37 +05:30
|
|
|
document.body.classList.add('is-dragging');
|
2018-12-13 13:39:08 +05:30
|
|
|
}
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export function sortableEnd() {
|
2017-08-17 22:00:37 +05:30
|
|
|
document.body.classList.remove('is-dragging');
|
2018-12-13 13:39:08 +05:30
|
|
|
}
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export function getBoardSortableDefaultOptions(obj) {
|
|
|
|
const touchEnabled =
|
|
|
|
'ontouchstart' in window || (window.DocumentTouch && document instanceof DocumentTouch);
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
const defaultSortOptions = {
|
|
|
|
...sortableConfig,
|
2019-09-30 21:07:59 +05:30
|
|
|
filter: '.no-drag',
|
2018-12-13 13:39:08 +05:30
|
|
|
delay: touchEnabled ? 100 : 0,
|
|
|
|
scrollSensitivity: touchEnabled ? 60 : 100,
|
2017-08-17 22:00:37 +05:30
|
|
|
scrollSpeed: 20,
|
2018-12-13 13:39:08 +05:30
|
|
|
onStart: sortableStart,
|
|
|
|
onEnd: sortableEnd,
|
2020-05-24 23:13:21 +05:30
|
|
|
};
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
Object.keys(obj).forEach((key) => {
|
2018-12-13 13:39:08 +05:30
|
|
|
defaultSortOptions[key] = obj[key];
|
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
return defaultSortOptions;
|
2018-12-13 13:39:08 +05:30
|
|
|
}
|