Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception: smallestImage is undefined (imageSize is undefined) #73

Closed
2SC1815J opened this issue Apr 30, 2019 · 4 comments
Closed

exception: smallestImage is undefined (imageSize is undefined) #73

2SC1815J opened this issue Apr 30, 2019 · 4 comments

Comments

@2SC1815J
Copy link
Contributor

2SC1815J commented Apr 30, 2019

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);
@mejackreed
Copy link
Owner

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
+ );

@2SC1815J
Copy link
Contributor Author

Thank you very much! That will be better.
Should I make a pull request to the branch release-0.2.x ?

@mejackreed
Copy link
Owner

Yes please

@mejackreed
Copy link
Owner

Resolved in #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants