Merge remote-tracking branch 'origin/master' into Navigator-Resize
Conflicts: changelog.txt
@ -11,6 +11,7 @@ OPENSEADRAGON CHANGELOG
|
|||||||
* Added a navigatorMaintainSizeRatio option. If set to true, the navigator minimap resizes when the viewer element is resized (#310)
|
* Added a navigatorMaintainSizeRatio option. If set to true, the navigator minimap resizes when the viewer element is resized (#310)
|
||||||
* Added 'ABSOLUTE' as a navigatorPosition option, along with corresponding navigatorTop, navigatorLeft options. Allows the navigator minimap to be placed anywhere in the viewer (#310)
|
* Added 'ABSOLUTE' as a navigatorPosition option, along with corresponding navigatorTop, navigatorLeft options. Allows the navigator minimap to be placed anywhere in the viewer (#310)
|
||||||
* Enhanced the navigatorTop, navigatorLeft, navigatorHeight, and navigatorWidth options to allow a number for pixel units or a string for other element units (%, em, etc.) (#310)
|
* Enhanced the navigatorTop, navigatorLeft, navigatorHeight, and navigatorWidth options to allow a number for pixel units or a string for other element units (%, em, etc.) (#310)
|
||||||
|
* Additional enhancements for IIIF support (#315)
|
||||||
|
|
||||||
1.0.0:
|
1.0.0:
|
||||||
|
|
||||||
|
@ -45,17 +45,46 @@
|
|||||||
*/
|
*/
|
||||||
$.IIIF1_1TileSource = function( options ){
|
$.IIIF1_1TileSource = function( options ){
|
||||||
|
|
||||||
|
|
||||||
$.extend( true, this, options );
|
$.extend( true, this, options );
|
||||||
|
|
||||||
|
|
||||||
if ( !( this.height && this.width && this['@id'] ) ){
|
if ( !( this.height && this.width && this['@id'] ) ){
|
||||||
throw new Error( 'IIIF required parameters not provided.' );
|
throw new Error( 'IIIF required parameters not provided.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !(this.tile_width && this.tile_height) ) {
|
if ( ( this.profile &&
|
||||||
// use the short dimension if there aren't tile sizes provided.
|
this.profile == "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" ) ){
|
||||||
options.tileSize = Math.min(this.height, this.width);
|
// what if not reporting a profile?
|
||||||
} else {
|
throw new Error( 'IIIF Image API 1.1 compliance level 1 or greater is required.' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( this.tile_width ) {
|
||||||
options.tileSize = this.tile_width;
|
options.tileSize = this.tile_width;
|
||||||
|
} else if ( this.tile_height ) {
|
||||||
|
options.tileSize = this.tile_height;
|
||||||
|
} else {
|
||||||
|
// use the largest of tileOptions that is smaller than the short
|
||||||
|
// dimension
|
||||||
|
|
||||||
|
var shortDim = Math.min( this.height, this.width ),
|
||||||
|
tileOptions = [256,512,1024],
|
||||||
|
smallerTiles = [];
|
||||||
|
|
||||||
|
for ( var c = 0; c < tileOptions.length; c++ ) {
|
||||||
|
if ( tileOptions[c] <= shortDim ) {
|
||||||
|
smallerTiles.push( tileOptions[c] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( smallerTiles.length > 0 ) {
|
||||||
|
options.tileSize = Math.max.apply( null, smallerTiles );
|
||||||
|
} else {
|
||||||
|
// If we're smaller than 256, just use the short side.
|
||||||
|
options.tileSize = shortDim;
|
||||||
|
}
|
||||||
|
this.tile_width = options.tileSize; // So that 'full' gets used for
|
||||||
|
this.tile_height = options.tileSize; // the region below
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !options.maxLevel ) {
|
if ( !options.maxLevel ) {
|
||||||
@ -83,12 +112,8 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open
|
|||||||
* @param {String} optional - url
|
* @param {String} optional - url
|
||||||
*/
|
*/
|
||||||
supports: function( data, url ) {
|
supports: function( data, url ) {
|
||||||
return data.profile && (
|
return ( data['@context'] &&
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" == data.profile ||
|
data['@context'] == "http://library.stanford.edu/iiif/image-api/1.1/context.json" );
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1" == data.profile ||
|
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2" == data.profile ||
|
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html" == data.profile
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,6 +149,7 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open
|
|||||||
getTileUrl: function( level, x, y ){
|
getTileUrl: function( level, x, y ){
|
||||||
|
|
||||||
//# constants
|
//# constants
|
||||||
|
|
||||||
var IIIF_ROTATION = '0',
|
var IIIF_ROTATION = '0',
|
||||||
IIIF_QUALITY = 'native.jpg',
|
IIIF_QUALITY = 'native.jpg',
|
||||||
|
|
||||||
@ -131,32 +157,34 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open
|
|||||||
scale = Math.pow( 0.5, this.maxLevel - level ),
|
scale = Math.pow( 0.5, this.maxLevel - level ),
|
||||||
|
|
||||||
//# image dimensions at this level
|
//# image dimensions at this level
|
||||||
level_width = Math.ceil( this.width * scale ),
|
levelWidth = Math.ceil( this.width * scale ),
|
||||||
level_height = Math.ceil( this.height * scale ),
|
levelHeight = Math.ceil( this.height * scale ),
|
||||||
|
|
||||||
//## iiif region
|
//## iiif region
|
||||||
iiif_tile_size_width = Math.ceil( this.tileSize / scale ),
|
iiifTileSizeWidth = Math.ceil( this.tileSize / scale ),
|
||||||
iiif_tile_size_height = Math.ceil( this.tileSize / scale ),
|
iiifTileSizeHeight = Math.ceil( this.tileSize / scale ),
|
||||||
iiif_region,
|
iiifRegion,
|
||||||
iiif_tile_x,
|
iiifTileX,
|
||||||
iiif_tile_y,
|
iiifTileY,
|
||||||
iiif_tile_w,
|
iiifTileW,
|
||||||
iiif_tile_h,
|
iiifTileH,
|
||||||
iiif_size,
|
iiifSize,
|
||||||
uri;
|
uri;
|
||||||
|
|
||||||
if ( level_width < this.tile_width && level_height < this.tile_height ){
|
if ( levelWidth < this.tile_width && levelHeight < this.tile_height ){
|
||||||
iiif_size = level_width + "," + level_height;
|
iiifSize = levelWidth + ",";
|
||||||
iiif_region = 'full';
|
iiifRegion = 'full';
|
||||||
} else {
|
} else {
|
||||||
iiif_tile_x = x * iiif_tile_size_width;
|
iiifTileX = x * iiifTileSizeWidth;
|
||||||
iiif_tile_y = y * iiif_tile_size_height;
|
iiifTileY = y * iiifTileSizeHeight;
|
||||||
iiif_tile_w = Math.min( iiif_tile_size_width, this.width - iiif_tile_x );
|
iiifTileW = Math.min( iiifTileSizeWidth, this.width - iiifTileX );
|
||||||
iiif_tile_h = Math.min( iiif_tile_size_height, this.height - iiif_tile_y );
|
iiifTileH = Math.min( iiifTileSizeHeight, this.height - iiifTileY );
|
||||||
iiif_size = Math.ceil(iiif_tile_w * scale) + "," + Math.ceil(iiif_tile_h * scale);
|
|
||||||
iiif_region = [ iiif_tile_x, iiif_tile_y, iiif_tile_w, iiif_tile_h ].join(',');
|
iiifSize = Math.ceil( iiifTileW * scale ) + ",";
|
||||||
|
|
||||||
|
iiifRegion = [ iiifTileX, iiifTileY, iiifTileW, iiifTileH ].join( ',' );
|
||||||
}
|
}
|
||||||
uri = [ this['@id'], iiif_region, iiif_size, IIIF_ROTATION, IIIF_QUALITY ].join('/');
|
uri = [ this['@id'], iiifRegion, iiifSize, IIIF_ROTATION, IIIF_QUALITY ].join( '/' );
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
18
test/data/iiif_1_1_no_tiles_1048.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",
|
||||||
|
"height": 870,
|
||||||
|
"width": 1048,
|
||||||
|
"qualities": [
|
||||||
|
"native",
|
||||||
|
"color",
|
||||||
|
"grey",
|
||||||
|
"bitonal"
|
||||||
|
],
|
||||||
|
"formats": [
|
||||||
|
"jpg",
|
||||||
|
"png",
|
||||||
|
"gif"
|
||||||
|
],
|
||||||
|
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
|
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_1048"
|
||||||
|
}
|
BIN
test/data/iiif_1_1_no_tiles_1048/0,0,1024,870/512,/0/native.jpg
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/0,0,512,512/512,/0/native.jpg
Normal file
After Width: | Height: | Size: 103 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/0,512,512,358/512,/0/native.jpg
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/1024,0,24,512/24,/0/native.jpg
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/1024,0,24,870/12,/0/native.jpg
Normal file
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 4.1 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/512,0,512,512/512,/0/native.jpg
Normal file
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 75 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/full/131,/0/native.jpg
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/full/17,/0/native.jpg
Normal file
After Width: | Height: | Size: 861 B |
BIN
test/data/iiif_1_1_no_tiles_1048/full/262,/0/native.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/full/33,/0/native.jpg
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
test/data/iiif_1_1_no_tiles_1048/full/66,/0/native.jpg
Normal file
After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 829 B After Width: | Height: | Size: 710 B |
18
test/data/iiif_1_1_no_tiles_255.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",
|
||||||
|
"height": 212,
|
||||||
|
"width": 255,
|
||||||
|
"qualities": [
|
||||||
|
"native",
|
||||||
|
"color",
|
||||||
|
"grey",
|
||||||
|
"bitonal"
|
||||||
|
],
|
||||||
|
"formats": [
|
||||||
|
"jpg",
|
||||||
|
"png",
|
||||||
|
"gif"
|
||||||
|
],
|
||||||
|
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
|
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_255"
|
||||||
|
}
|
BIN
test/data/iiif_1_1_no_tiles_255/0,0,212,212/212,/0/native.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
test/data/iiif_1_1_no_tiles_255/212,0,43,212/43,/0/native.jpg
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
test/data/iiif_1_1_no_tiles_255/full/128,/0/native.jpg
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
test/data/iiif_1_1_no_tiles_255/full/16,/0/native.jpg
Normal file
After Width: | Height: | Size: 824 B |
BIN
test/data/iiif_1_1_no_tiles_255/full/32,/0/native.jpg
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 690 B |
BIN
test/data/iiif_1_1_no_tiles_255/full/64,/0/native.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
test/data/iiif_1_1_no_tiles_255/full/8,/0/native.jpg
Normal file
After Width: | Height: | Size: 689 B |
18
test/data/iiif_1_1_no_tiles_384.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",
|
||||||
|
"height": 319,
|
||||||
|
"width": 384,
|
||||||
|
"qualities": [
|
||||||
|
"native",
|
||||||
|
"color",
|
||||||
|
"grey",
|
||||||
|
"bitonal"
|
||||||
|
],
|
||||||
|
"formats": [
|
||||||
|
"jpg",
|
||||||
|
"png",
|
||||||
|
"gif"
|
||||||
|
],
|
||||||
|
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
|
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_384"
|
||||||
|
}
|
BIN
test/data/iiif_1_1_no_tiles_384/0,0,256,256/256,/0/native.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
test/data/iiif_1_1_no_tiles_384/0,256,256,63/256,/0/native.jpg
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
test/data/iiif_1_1_no_tiles_384/256,0,128,256/128,/0/native.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
test/data/iiif_1_1_no_tiles_384/256,256,128,63/128,/0/native.jpg
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
test/data/iiif_1_1_no_tiles_384/full/12,/0/native.jpg
Normal file
After Width: | Height: | Size: 758 B |
BIN
test/data/iiif_1_1_no_tiles_384/full/192,/0/native.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
test/data/iiif_1_1_no_tiles_384/full/24,/0/native.jpg
Normal file
After Width: | Height: | Size: 1012 B |
BIN
test/data/iiif_1_1_no_tiles_384/full/48,/0/native.jpg
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
test/data/iiif_1_1_no_tiles_384/full/6,/0/native.jpg
Normal file
After Width: | Height: | Size: 691 B |
BIN
test/data/iiif_1_1_no_tiles_384/full/96,/0/native.jpg
Normal file
After Width: | Height: | Size: 5.2 KiB |
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",
|
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",
|
||||||
"height": 850,
|
"height": 637,
|
||||||
"width": 1024,
|
"width": 768,
|
||||||
"qualities": [
|
"qualities": [
|
||||||
"native",
|
"native",
|
||||||
"color",
|
"color",
|
||||||
@ -14,6 +14,5 @@
|
|||||||
"gif"
|
"gif"
|
||||||
],
|
],
|
||||||
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
"@id": "http://localhost:8000/test/data/iiif_no_tiles"
|
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_768"
|
||||||
}
|
}
|
||||||
|
|
BIN
test/data/iiif_1_1_no_tiles_768/0,0,512,512/512,/0/native.jpg
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/0,512,512,125/512,/0/native.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/512,0,256,512/256,/0/native.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 14 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/full/12,/0/native.jpg
Normal file
After Width: | Height: | Size: 764 B |
BIN
test/data/iiif_1_1_no_tiles_768/full/192,/0/native.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/full/24,/0/native.jpg
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/full/384,/0/native.jpg
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/full/48,/0/native.jpg
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
test/data/iiif_1_1_no_tiles_768/full/6,/0/native.jpg
Normal file
After Width: | Height: | Size: 690 B |
BIN
test/data/iiif_1_1_no_tiles_768/full/96,/0/native.jpg
Normal file
After Width: | Height: | Size: 5.4 KiB |
@ -24,5 +24,5 @@
|
|||||||
"gif"
|
"gif"
|
||||||
],
|
],
|
||||||
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
"@id": "http://localhost:8000/test/data/iiif_1_1_files"
|
"@id": "http://localhost:8000/test/data/iiif_1_1_tiled"
|
||||||
}
|
}
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 717 B After Width: | Height: | Size: 717 B |
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 717 B After Width: | Height: | Size: 717 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 810 B |
Before Width: | Height: | Size: 663 B After Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 675 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 351 KiB |
@ -77,12 +77,27 @@
|
|||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
asyncTest('IIIF 1.1 JSON', function() {
|
asyncTest('IIIF 1.1 JSON', function() {
|
||||||
testOpen('iiif1_1.json');
|
testOpen('iiif_1_1_tiled.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
asyncTest('IIIF No Tiles', function() {
|
asyncTest('IIIF No Tiles, Less than 256', function() {
|
||||||
testOpen('iiif_no_tiles.json');
|
testOpen('iiif_1_1_no_tiles_255.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF No Tiles, Bet. 256 and 512', function() {
|
||||||
|
testOpen('iiif_1_1_no_tiles_384.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF No Tiles, Bet. 512 and 1024', function() {
|
||||||
|
testOpen('iiif_1_1_no_tiles_768.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF No Tiles, Larger than 1024', function() {
|
||||||
|
testOpen('iiif_1_1_no_tiles_1048.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|