Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(gestures): resolves jQuery conflict with $mdGesture
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Messerle committed Feb 27, 2015
1 parent 0523f83 commit 7950588
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/core/services/gesture/gesture.js
Expand Up @@ -24,7 +24,7 @@ if (shouldHijackClicks) {
document.addEventListener('click', function(ev) {
// Space/enter on a button, and submit events, can send clicks
var isKeyClick = ev.clientX === 0 && ev.clientY === 0;
if (isKeyClick || ev.$material) return;
if (window.jQuery || isKeyClick || ev.$material) return;

// Prevent clicks unless they're sent by material
ev.preventDefault();
Expand Down Expand Up @@ -170,7 +170,7 @@ angular.module('material.core')
// If the user keeps his finger within the same <maxDistance> area for
// <delay> ms, dispatch a hold event.
maxDistance: 6,
delay: 500,
delay: 500
},
onCancel: function() {
$timeout.cancel(this.state.timeout);
Expand All @@ -195,15 +195,13 @@ angular.module('material.core')
this.cancel();
}
},
onEnd: function(ev, pointer) {
this.onCancel();
},
onEnd: function() { this.onCancel(); }
});

addHandler('drag', {
options: {
minDistance: 6,
horizontal: true,
horizontal: true
},
onStart: function(ev) {
// For drag, require a parent to be registered with $mdGesture.register()
Expand Down Expand Up @@ -256,7 +254,7 @@ angular.module('material.core')
addHandler('swipe', {
options: {
minVelocity: 0.65,
minDistance: 10,
minDistance: 10
},
onEnd: function(ev, pointer) {
if (Math.abs(pointer.velocityX) > this.state.options.minVelocity &&
Expand Down Expand Up @@ -356,12 +354,12 @@ angular.module('material.core')
delete element[0].$mdGesture[self.name];
element.off('$destroy', onDestroy);
}
},
}
};

function jQueryDispatchEvent(srcEvent, eventType, eventPointer) {
eventPointer = eventPointer || pointer;
var eventObj = new angular.element.Event(eventType)
var eventObj = new angular.element.Event(eventType);

eventObj.$material = true;
eventObj.pointer = eventPointer;
Expand Down

0 comments on commit 7950588

Please sign in to comment.