From bb729b9c024038ea7b8449f5a70e1e7c4a5c1980 Mon Sep 17 00:00:00 2001 From: janus j k lu <januslo6211@icloud.com> Date: Thu, 21 Dec 2017 17:08:48 +0800 Subject: [PATCH 1/3] Reserves witch button detect logic Reserves witch button detect logic --- dist/dragula.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/dragula.js b/dist/dragula.js index 67b93812..4d9e3dc3 100644 --- a/dist/dragula.js +++ b/dist/dragula.js @@ -556,13 +556,15 @@ function touchy (el, op, type, fn) { } function whichMouseButton (e) { - if (e.touches !== void 0) { return e.touches.length; } - if (e.which !== void 0 && e.which !== 0) { return e.which; } // see https://github.com/bevacqua/dragula/issues/261 - if (e.buttons !== void 0) { return e.buttons; } - var button = e.button; - if (button !== void 0) { // see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575 - return button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0); - } + if (e.touches) { return e.touches.length; } + if (e.originalEvent && e.originalEvent.touches) { return e.originalEvent.touches.length; } + if (e.which !== void 0 && e.which !== 0) { return e.which; } // github.com/bevacqua/dragula/issues/261 + var button = e.button; + if (button !== undefined) { // see github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575 + // button == 0?1:** for the e object was unwrapped orginalEvent object in jQuery enviroment. + return button==0?1:button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0); + } + if (e.buttons !== undefined) { return e.buttons; } } function getOffset (el) { From cd4e28b2b20776bb534ebafc764a1d53ed0ee6f8 Mon Sep 17 00:00:00 2001 From: janus j k lu <januslo6211@icloud.com> Date: Thu, 21 Dec 2017 17:12:42 +0800 Subject: [PATCH 2/3] Reserves the which button detect logic Reserves the which button detect logic --- dragula.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dragula.js b/dragula.js index 4f732311..82b5fc6c 100644 --- a/dragula.js +++ b/dragula.js @@ -519,13 +519,15 @@ function touchy (el, op, type, fn) { } function whichMouseButton (e) { - if (e.touches !== void 0) { return e.touches.length; } - if (e.which !== void 0 && e.which !== 0) { return e.which; } // see https://github.com/bevacqua/dragula/issues/261 - if (e.buttons !== void 0) { return e.buttons; } - var button = e.button; - if (button !== void 0) { // see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575 - return button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0); - } + if (e.touches) { return e.touches.length; } + if (e.originalEvent && e.originalEvent.touches) { return e.originalEvent.touches.length; } + if (e.which !== void 0 && e.which !== 0) { return e.which; } // github.com/bevacqua/dragula/issues/261 + var button = e.button; + if (button !== undefined) { // see github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575 + // button == 0?1:** for the e object was unwrapped orginalEvent object in jQuery enviroment. + return button==0?1:button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0); + } + if (e.buttons !== undefined) { return e.buttons; } } function getOffset (el) { From 87a4431f29c3e3d1c0ef57d53957549d1b3426d5 Mon Sep 17 00:00:00 2001 From: janus j k lu <januslo6211@icloud.com> Date: Thu, 21 Dec 2017 17:58:26 +0800 Subject: [PATCH 3/3] Rollback Rollback --- dist/dragula.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dist/dragula.js b/dist/dragula.js index 4d9e3dc3..67b93812 100644 --- a/dist/dragula.js +++ b/dist/dragula.js @@ -556,15 +556,13 @@ function touchy (el, op, type, fn) { } function whichMouseButton (e) { - if (e.touches) { return e.touches.length; } - if (e.originalEvent && e.originalEvent.touches) { return e.originalEvent.touches.length; } - if (e.which !== void 0 && e.which !== 0) { return e.which; } // github.com/bevacqua/dragula/issues/261 - var button = e.button; - if (button !== undefined) { // see github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575 - // button == 0?1:** for the e object was unwrapped orginalEvent object in jQuery enviroment. - return button==0?1:button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0); - } - if (e.buttons !== undefined) { return e.buttons; } + if (e.touches !== void 0) { return e.touches.length; } + if (e.which !== void 0 && e.which !== 0) { return e.which; } // see https://github.com/bevacqua/dragula/issues/261 + if (e.buttons !== void 0) { return e.buttons; } + var button = e.button; + if (button !== void 0) { // see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575 + return button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0); + } } function getOffset (el) {