Skip to content

Commit

Permalink
added option to disable drag on mouse events #80 (@jamuhl)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakiestfu committed Mar 8, 2014
1 parent a37610c commit 56afd8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/js/snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
minPosition: -266,
tapToClose: true,
touchToDrag: true,
clickToDrag: true,
slideIntent: 40, // degrees
minDragDistance: 5
};
Expand Down
8 changes: 4 additions & 4 deletions src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
},
Expand Down

1 comment on commit 56afd8d

@jamuhl
Copy link

@jamuhl jamuhl commented on 56afd8d Mar 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakiestfu great...thanks...keep up the good work.

Please sign in to comment.