exception: smallestImage is undefined (imageSize is undefined)
2SC1815J opened this issue · 4 comments
If options.tileSize is greater than image size, you will have an exception as follows.
https://iiif.dl.itc.u-tokyo.ac.jp/omekac/iiif/6134/manifest
https://iiif.dl.itc.u-tokyo.ac.jp/omekac/iiif-img/1631/info.json
Leaflet 1.4.0+Leaflet-IIIF 2.0.1
jQuery.Deferred exception: smallestImage is undefined onAdd/<@https://rawgit.com/mejackreed/Leaflet-IIIF/v2.0.1/leaflet-iiif.js:81:1
Leaflet 0.7.7+Leaflet-IIIF 0.2.0
jQuery.Deferred exception: imageSize is undefined _fitBounds@https://rawgit.com/mejackreed/Leaflet-IIIF/v0.2.0/leaflet-iiif.js:94:9
(In Leaflet-IIIF 0.2.0, this will happen only when info.json lacks tiles
property. This property is optional by spec. rel. #56)
This seems to be caused by the following points, _this.maxNativeZoom becomes -1.
_this.maxNativeZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
ceilLog2(_this.y / _this.options.tileSize));
Because of #64, I still have to use Leaflet-IIIF 0.2.0. The following workaround will be OK?
_this.maxNativeZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
ceilLog2(_this.y / _this.options.tileSize),
0);
That seems like a good solution. It seems like this is only happening when an explicit tileSize
option is passed in.
Also what about this (I'm trying to think about future comprehension and readability)
// Calculates maximum native zoom for the layer
- _this.maxNativeZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
- ceilLog2(_this.y / _this.options.tileSize));
+ _this.maxNativeZoom = Math.max(
+ ceilLog2(_this.x / _this.options.tileSize),
+ ceilLog2(_this.y / _this.options.tileSize),
+ 0
+ );
Thank you very much! That will be better.
Should I make a pull request to the branch release-0.2.x
?
Yes please
Resolved in #74