I am trying to download full size of deep zoom images using openseadragon (OSD) version 2.2.1. My images are on a server and I am able to open them using OSD. My steps for downloading them are:
Download function has following functionality:
Full Size of the source for OSD viewer:
$("#OSDelement").attr("style", "height: " + viewer.world.getItemAt(0).source.dimensions.y / window.devicePixelRatio) + "px;" +
"width: " + (viewer.world.getItemAt(0).source.dimensions.x / window.devicePixelRatio) + "px");
Sample mock-up of the site is:
Everything is downloading fine when the browser's tab is active (it takes time to download, but it is doing its job). Problem is that I am trying to download in 'background'. When I am going to the different tab, OSD tiles stop loading. How do I force OSD open and load tiles when browser's tab is not active? Sometimes it starts downloading when tab is not active per browser session, but tiles not drawing at all. It downloads empty files, because there are no tiles on the viewer. There are no errors at all.
Please give me some ideas. Thanks!
The reason it doesn't work in the background is that it's using requestAnimationFrame, which pauses when your tab is in the background. One fix would be to do something like:
OpenSeadragon.requestAnimationFrame = function(callback) {
setTimeout(callback, 16);
};