summaryrefslogtreecommitdiffstats
path: root/client/lib/utils.js
diff options
context:
space:
mode:
authorHaocen Xu <haocen.xu@gmail.com>2018-07-06 14:42:36 -0400
committerHaocen Xu <haocen.xu@gmail.com>2018-07-06 14:42:36 -0400
commit616dade81c25b10fc409aee1bcc9a93ddbfee81b (patch)
tree16188860b3eb7db871ab75c2094db91407e21926 /client/lib/utils.js
parent43d86d7d5d3f3b34b0500f6d5d3afe7bd86b0060 (diff)
downloadwekan-616dade81c25b10fc409aee1bcc9a93ddbfee81b.tar.gz
wekan-616dade81c25b10fc409aee1bcc9a93ddbfee81b.tar.bz2
wekan-616dade81c25b10fc409aee1bcc9a93ddbfee81b.zip
Hotfix more sortable elements
Diffstat (limited to 'client/lib/utils.js')
-rw-r--r--client/lib/utils.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/client/lib/utils.js b/client/lib/utils.js
index 7e2651d2..b70faec6 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -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);
+ });
},
};