Merge pull request #1401 from hyperknot/master

Fixed IIIF options.maxLevel calculation
This commit is contained in:
Ian Gilman 2018-02-26 11:59:18 -08:00 committed by GitHub
commit 23ec3284b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 72 additions and 1 deletions

View File

@ -127,7 +127,8 @@ $.IIIFTileSource = function( options ){
if (!this.scale_factors) { if (!this.scale_factors) {
options.maxLevel = Number(Math.ceil(Math.log(Math.max(this.width, this.height), 2))); options.maxLevel = Number(Math.ceil(Math.log(Math.max(this.width, this.height), 2)));
} else { } else {
options.maxLevel = Math.floor(Math.pow(Math.max.apply(null, this.scale_factors), 0.5)); var maxScaleFactor = Math.max.apply(null, this.scale_factors);
options.maxLevel = Math.round(Math.log(maxScaleFactor) * Math.LOG2E);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

View File

@ -0,0 +1,31 @@
{
"@context": "http://iiif.io/api/image/2/context.json",
"@id": "http://localhost:8000/test/data/iiif_2_0_tiled_sf1",
"protocol": "http://iiif.io/api/image",
"height": 1024,
"width": 775,
"tiles": [
{
"width": 256,
"scaleFactors": [
1
]
}
],
"profile": [
"http://iiif.io/api/image/2/level1.json",
{
"qualities": [
"native",
"bitonal",
"grey",
"color"
],
"formats": [
"jpg",
"png",
"gif"
]
}
]
}

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenSeadragon Demo - IIIF Tiled scaleFactors [1]</title>
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
<script type="text/javascript" src='../lib/jquery-1.9.1.min.js'></script>
<style type="text/css">
.openseadragon1 {
width: 400px;
height: 300px;
}
</style>
</head>
<body>
<div>
<p>Default OpenSeadragon viewer from IIIF Tile Source.</p>
<p>This is for testing the support for scaleFactors [1]</p>
</div>
<div id="contentDiv" class="openseadragon1"></div>
<script type="text/javascript">
var viewer = OpenSeadragon({
// debugMode: true,
id: "contentDiv",
prefixUrl: "../../build/openseadragon/images/",
tileSources: "../data/iiif_2_0_tiled_sf1/info.json",
showNavigator: true
});
</script>
</body>
</html>

View File

@ -113,6 +113,11 @@
testOpenUrl('iiif_2_0_tiled/info.json', assert); testOpenUrl('iiif_2_0_tiled/info.json', assert);
}); });
// ----------
QUnit.test('IIIF 2.0 JSON scaleFactors [1]', function(assert) {
testOpenUrl('iiif_2_0_tiled_sf1/info.json', assert);
});
// ---------- // ----------
QUnit.test('IIIF 2.0 JSON, sizes array only', function(assert) { QUnit.test('IIIF 2.0 JSON, sizes array only', function(assert) {
testOpenUrl('iiif_2_0_sizes/info.json', assert); testOpenUrl('iiif_2_0_sizes/info.json', assert);