Merge pull request #332 from samatjain/firefox

Support Firefox Mobile/Fennec
This commit is contained in:
Vladimir Agafonkin 2011-10-15 01:40:14 -07:00
commit 60b1e72bbd
2 changed files with 28 additions and 3 deletions

View File

@ -22,6 +22,31 @@
mobileOpera: mobile && opera, mobileOpera: mobile && opera,
mobile: mobile, mobile: mobile,
touch: ('ontouchstart' in document.documentElement) touch: (function() {
var touchSupported = false;;
// WebKit, etc
if ('ontouchstart' in document.documentElement) {
return true;
}
// Firefox/Gecko
var e = document.createElement('div');
// If no support for basic event stuff, unlikely to have touch support
if (!e.setAttribute || !e.removeAttribute) {
return false;
}
e.setAttribute('ontouchstart', 'return;');
if (typeof e['ontouchstart'] == 'function') {
touchSupported = true;
}
e.removeAttribute('ontouchstart');
e = null;
return touchSupported;
})()
}; };
})(); })();

View File

@ -30,7 +30,7 @@ L.Draggable = L.Class.extend({
}, },
_onDown: function(e) { _onDown: function(e) {
if (e.shiftKey || ((e.which != 1) && (e.button != 1) && !e.touches)) { return; } if ((!L.Browser.touch && e.shiftKey) || ((e.which != 1) && (e.button != 1) && !e.touches)) { return; }
if (e.touches && e.touches.length > 1) { return; } if (e.touches && e.touches.length > 1) { return; }