Leaflet 1.0: revert touch style in desktop browsers, fixes #69

This commit is contained in:
Norbert Renner 2017-08-07 11:26:49 +02:00
parent 6c316c8688
commit cd6c1bdc54
3 changed files with 34 additions and 0 deletions

24
js/Browser.js Normal file
View file

@ -0,0 +1,24 @@
(function () {
var touchScreen = (function () {
var result = null;
if ('maxTouchPoints' in navigator) {
result = navigator.maxTouchPoints > 0;
} else if (window.matchMedia && window.matchMedia('(any-pointer:coarse),(any-pointer:fine),(any-pointer:none)').matches) {
result = window.matchMedia("(any-pointer:coarse)").matches;
} else if ('msMaxTouchPoints' in navigator) {
result = navigator.msMaxTouchPoints > 0;
};
return result;
}()),
touchScreenDetectable = touchScreen !== null;
BR.Browser = {
touchScreen: touchScreen,
touchScreenDetectable: touchScreenDetectable
};
}());