mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Hotfix more sortable elements
This commit is contained in:
parent
43d86d7d5d
commit
616dade81c
6 changed files with 21 additions and 22 deletions
|
|
@ -123,23 +123,24 @@ Utils = {
|
|||
);
|
||||
},
|
||||
|
||||
enableClickOnTouch(element) {
|
||||
enableClickOnTouch(selector) {
|
||||
let touchStart = null;
|
||||
let lastTouch = null;
|
||||
element.addEventListener('touchstart', function(e) {
|
||||
touchStart = e.touches[0];
|
||||
}, false);
|
||||
element.addEventListener('touchmove', function(e) {
|
||||
const touches = e.touches;
|
||||
|
||||
$(document).on('touchstart', selector, function(e) {
|
||||
touchStart = e.originalEvent.touches[0];
|
||||
});
|
||||
$(document).on('touchmove', selector, function(e) {
|
||||
const touches = e.originalEvent.touches;
|
||||
lastTouch = touches[touches.length - 1];
|
||||
}, true);
|
||||
element.addEventListener('touchend', function() {
|
||||
});
|
||||
$(document).on('touchend', selector, function(e) {
|
||||
if (touchStart && lastTouch && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20) {
|
||||
const clickEvent = document.createEvent('MouseEvents');
|
||||
clickEvent.initEvent('click', true, true);
|
||||
this.dispatchEvent(clickEvent);
|
||||
e.target.dispatchEvent(clickEvent);
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue