Closed lutzhelm closed 5 years ago
I've put the example image (and two other random examples with the same problem) into a little demo: https://lutzhelm.github.io/kitodo-presentation-306.html
The following shows the behaviour with maxZoom calculated from the maximum resolution: https://lutzhelm.github.io/kitodo-presentation-306-working.html
While the solution I suggested improves the viewers behaviour and using powers of 2 as resolutions if no scaleFactors are given will work smoothly, there remains the problem that the scaleFactors provided by an info.json do not have to be consecutive values of powers to 2. In fact, any positive integer is allowed. This is bound to cause conflicts with OpenLayers whose default zoomFactor 2 will not work together with an arbitrary set of scaleFactors provided by an info.json.
So additionally I'd suggest that the scaleFactors are to be ignored if they are not a consecutive sequence of powers to 2 after sorting. In that case the viewer should provide a set of resolutions calculated from maxZoom. Size by percentage must be supported by all IIIF image servers at level 1 and 2, so the only problem may be performance issues if the calculated resolutions perform worse than the scaleFactors from the image's info.json.
I have updated the working demo with the solution from the pull request.
In
dlfViewerSource.IIIF
, a value formaxZoom
is calculated that is later used by the source to determine the correct scale for a given zoom level.https://github.com/kitodo/kitodo-presentation/blob/e78f28458927a90f1249b0bef795a9685c630ec7/plugins/pageview/tx_dlf_ol3_source.js#L93-L97
If the zoom levels from 0 to
maxZoom
and the reverse values inresolutions
(which originate from the IIIF image scale factors) do not correspond, the IIIF tile source will provide tiles for the wrong zoom level.An Example
height
of 1883 pixels (which is greater than thewidth
), a tile width of 512 pixels and thescaleFactors
[1,2,4,8,16]
maxZoom
would be 2 as 2^2=4 tiles of 512x512 pixels are enough to contain the height of 1883 pixels[16,8,4,2,1]
which is 4 (ie. 1/4 of the full image resolution)Possible solution
resolutions
are provided,maxZoom
should be determined from those resolutions as logarithm to base 2 of the maximum resolutionscale_factors
is optionaltiles
is optional; iftiles
is not givenscaleFactors
is not given either; iftiles
exists each entry it must containscaleFactors
[1,2,4,8,16]
as I had suggested in #279 but rather be calculated from the then correctly calculatedmaxZoom
(with values ranging from 2^0 to 2^maxZoom)I could provide a pull request for that solution.