Merge pull request #1401 from hyperknot/master
Fixed IIIF options.maxLevel calculation
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
test/data/iiif_2_0_tiled_sf1/0,0,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/0,256,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/0,512,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/0,768,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/256,0,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/256,256,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/256,512,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/256,768,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/512,0,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/512,256,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/512,512,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/512,768,256,256/256,/0/default.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_2_0_tiled_sf1/768,0,7,256/7,/0/default.jpg
Normal file
After Width: | Height: | Size: 717 B |
BIN
test/data/iiif_2_0_tiled_sf1/768,256,7,256/7,/0/default.jpg
Normal file
After Width: | Height: | Size: 716 B |
BIN
test/data/iiif_2_0_tiled_sf1/768,512,7,256/7,/0/default.jpg
Normal file
After Width: | Height: | Size: 717 B |
BIN
test/data/iiif_2_0_tiled_sf1/768,768,7,256/7,/0/default.jpg
Normal file
After Width: | Height: | Size: 712 B |
31
test/data/iiif_2_0_tiled_sf1/info.json
Normal 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
34
test/demo/iiif-tiled-sf1.html
Normal 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>
|
@ -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);
|
||||||
|