openseadragon / openseadragon

An open-source, web-based viewer for zoomable images, implemented in pure JavaScript.
http://openseadragon.github.io/
BSD 3-Clause "New" or "Revised" License
3k stars 594 forks source link

[Performance] loading new tiles with .open() makes TAPS lag for seconds! #1909

Closed ahmed4end closed 3 years ago

ahmed4end commented 3 years ago

i'm using multiple taps on my site, one of the taps has the openseadragon viewer inside it, when clicking certain button js fires -> viewer.open(tiles) which causes navigating between taps lags for 2 seconds, what can i do to make it load new images smoothly without doing anything with the performance of the taps switching !

var viewer = OpenSeadragon({ id: "wheelzoom.exe", immediateRender: true, prefixUrl: 'https://openseadragon.github.io/openseadragon/images/', });

$('#btn').on('click', function() { viewer.open( tiles );})

msalsbery commented 3 years ago

@ahmed4end

The majority of the work done when opening a tile source is asynchronous so your UI shouldn't be slowed much. Do you have any event handlers on your viewer that wait for anything?

ahmed4end commented 3 years ago

@msalsbery yeah i do have handlers.... i use .open() to open two images then the handlers are for the swapping between the images in the viewer .