Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils_misc: deprecate window.isTouchDevice #463

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/code/utils_misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ window.showPortalPosLinks = function(lat, lng, name) {
}
}

window.isTouchDevice = function() {
window.isTouchDevice = function() { // deprecated!! (prefer L.Browser.touch instead)
return 'ontouchstart' in window // works on most browsers
|| 'onmsgesturechange' in window; // works on ie10
Comment on lines 266 to 267
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively:

Suggested change
return 'ontouchstart' in window // works on most browsers
|| 'onmsgesturechange' in window; // works on ie10
return 'maxTouchPoints' in navigator && navigator.maxTouchPoints > 0;

};
Expand Down
10 changes: 4 additions & 6 deletions plugins/player-activity-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ window.plugin.playerTracker.closeIconTooltips = function() {
window.plugin.playerTracker.zoomListener = function() {
var ctrl = $('.leaflet-control-layers-selector + span:contains("Player Tracker")').parent();
if(window.map.getZoom() < window.PLAYER_TRACKER_MIN_ZOOM) {
if (!window.isTouchDevice()) plugin.playerTracker.closeIconTooltips();
if (!L.Browser.touch) plugin.playerTracker.closeIconTooltips();
plugin.playerTracker.drawnTracesEnl.clearLayers();
plugin.playerTracker.drawnTracesRes.clearLayers();
ctrl.addClass('disabled').attr('title', 'Zoom in to show those.');
Expand Down Expand Up @@ -258,8 +258,6 @@ window.plugin.playerTracker.ago = function(time, now) {
}

window.plugin.playerTracker.drawData = function() {
var isTouchDev = window.isTouchDevice();

var gllfe = plugin.playerTracker.getLatLngFromEvent;

var polyLineByAgeEnl = [[], [], [], []];
Expand Down Expand Up @@ -292,7 +290,7 @@ window.plugin.playerTracker.drawData = function() {
var ago = plugin.playerTracker.ago;

// tooltip for marker - no HTML - and not shown on touchscreen devices
var tooltip = isTouchDev ? '' : (playerData.nick+', '+ago(last.time, now)+' ago');
var tooltip = L.Browser.touch ? '' : (playerData.nick+', '+ago(last.time, now)+' ago');

// popup for marker
var popup = $('<div>')
Expand Down Expand Up @@ -397,7 +395,7 @@ window.plugin.playerTracker.drawData = function() {
window.registerMarkerForOMS(m);

// jQueryUI doesn’t automatically notice the new markers
if (!isTouchDev) {
if (!L.Browser.touch) {
window.setupTooltips($(m._icon));
}
});
Expand Down Expand Up @@ -463,7 +461,7 @@ window.plugin.playerTracker.handleData = function(data) {

plugin.playerTracker.discardOldData();
plugin.playerTracker.processNewData(data);
if (!window.isTouchDevice()) plugin.playerTracker.closeIconTooltips();
if (!L.Browser.touch) plugin.playerTracker.closeIconTooltips();

plugin.playerTracker.drawnTracesEnl.clearLayers();
plugin.playerTracker.drawnTracesRes.clearLayers();
Expand Down