From 56afd8d28123958f8553409226b02838cfdc98a9 Mon Sep 17 00:00:00 2001 From: Jacob Kelley Date: Sat, 8 Mar 2014 14:24:14 -0800 Subject: [PATCH] added option to disable drag on mouse events #80 (@jamuhl) --- src/js/snap.js | 1 + src/js/utils.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/snap.js b/src/js/snap.js index b756177..30da543 100755 --- a/src/js/snap.js +++ b/src/js/snap.js @@ -20,6 +20,7 @@ minPosition: -266, tapToClose: true, touchToDrag: true, + clickToDrag: true, slideIntent: 40, // degrees minDragDistance: 5 }; diff --git a/src/js/utils.js b/src/js/utils.js index ccb5d23..b46e8a3 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -9,10 +9,10 @@ hasTouch: ('ontouchstart' in doc.documentElement || win.navigator.msPointerEnabled), eventType: function(action) { var eventTypes = { - down: (utils.hasTouch ? 'touchstart' : 'mousedown'), - move: (utils.hasTouch ? 'touchmove' : 'mousemove'), - up: (utils.hasTouch ? 'touchend' : 'mouseup'), - out: (utils.hasTouch ? 'touchcancel' : 'mouseout') + down: (utils.hasTouch ? 'touchstart' : settings.clickToDrag ? 'mousedown' : ''), + move: (utils.hasTouch ? 'touchmove' : settings.clickToDrag ? 'mousemove' : ''), + up: (utils.hasTouch ? 'touchend' : settings.clickToDrag ? 'mouseup': ''), + out: (utils.hasTouch ? 'touchcancel' : settings.clickToDrag ? 'mouseout' : '') }; return eventTypes[action]; },