add function to start 'idle' mode - for use in the mobile app (rather than it forcing the idle timer)

the existing idle resume function can be used on returning to iitc

also, fix the long-standing bug on mobile where the map disappears after repeated touch panning/zooming. seems leaflet gets confused about zoom levels and ends up with a non-ingeger. when this is found, force it back to an ingeger zoom level when this happens
This commit is contained in:
Jon Atkins
2013-09-16 00:01:25 +01:00
parent 59e5be98ed
commit 9b3caa8eb9
2 changed files with 25 additions and 5 deletions

View File

@ -10,8 +10,7 @@ var idlePoll = function() {
var hidden = (document.hidden || document.webkitHidden || document.mozHidden || document.msHidden || false);
if (hidden) {
// window hidden - use the refresh time as the idle limit, rather than the max time
window._idleTimeLimit = window.REFRESH;
window.idleSet();
}
}
@ -29,6 +28,14 @@ var idleReset = function () {
window._idleTimeLimit = MAX_IDLE_TIME;
};
var idleSet = function() {
// force IITC to idle. used by the mobile app when switching to something else
if (!isIdle()) {
window._idleTImeLimit = 0;
}
}
// only reset idle on mouse move where the coordinates are actually different.
// some browsers send the event when not moving!
var _lastMouseX=-1, _lastMouseY=-1;