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:
11
code/idle.js
11
code/idle.js
@ -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;
|
||||
|
Reference in New Issue
Block a user