Merge branch 'master' of github.com:openseadragon/openseadragon
Fixed Conflicts: changelog.txt
@ -34,6 +34,7 @@ module.exports = function(grunt) {
|
|||||||
"src/tilesource.js",
|
"src/tilesource.js",
|
||||||
"src/dzitilesource.js",
|
"src/dzitilesource.js",
|
||||||
"src/iiiftilesource.js",
|
"src/iiiftilesource.js",
|
||||||
|
"src/iiif1_1tilesource.js",
|
||||||
"src/osmtilesource.js",
|
"src/osmtilesource.js",
|
||||||
"src/tmstilesource.js",
|
"src/tmstilesource.js",
|
||||||
"src/legacytilesource.js",
|
"src/legacytilesource.js",
|
||||||
|
@ -3,12 +3,24 @@ OPENSEADRAGON CHANGELOG
|
|||||||
|
|
||||||
1.0.0: (in progress)
|
1.0.0: (in progress)
|
||||||
|
|
||||||
|
* BREAKING CHANGE: TileSource 'ready' event handler signature changed for consistency to 'handlerMethod( eventSource, eventData)' (#239)
|
||||||
* BREAKING CHANGE: Renamed EventHandler to EventSource (#225)
|
* BREAKING CHANGE: Renamed EventHandler to EventSource (#225)
|
||||||
* BREAKING CHANGE: MouseTracker event handler method signatures changed to 'handlerMethod( tracker, eventData)' (#23)
|
* BREAKING CHANGE: MouseTracker event handler method signatures changed to 'handlerMethod( tracker, eventData)' (#23)
|
||||||
|
* BREAKING CHANGE: Event names changed for consistency: changed to lower case, compound names hyphenated, and "on" prefixes removed (#226):
|
||||||
|
* Viewer "animationstart" changed to "animation-start"
|
||||||
|
* Viewer "animationfinish" changed to "animation-finish"
|
||||||
|
* Button "onPress" changed to "press"
|
||||||
|
* Button "onRelease" changed to "release"
|
||||||
|
* Button "onClick" changed to "click"
|
||||||
|
* Button "onEnter" changed to "enter"
|
||||||
|
* Button "onExit" changed to "exit"
|
||||||
|
* Button "onFocus" changed to "focus"
|
||||||
|
* Button "onBlur" changed to "blur"
|
||||||
* MouseTracker now passes the original event objects to its handler methods (#23)
|
* MouseTracker now passes the original event objects to its handler methods (#23)
|
||||||
* MouseTracker now supports an optional 'moveHandler' method for tracking mousemove events (#215)
|
* MouseTracker now supports an optional 'moveHandler' method for tracking mousemove events (#215)
|
||||||
* Fixed: Element-relative mouse coordinates now correct if the element and/or page is scrolled (using new OpenSeadragon.getElementOffset() method) (#131)
|
* Fixed: Element-relative mouse coordinates now correct if the element and/or page is scrolled (using new OpenSeadragon.getElementOffset() method) (#131)
|
||||||
* Added IIIF Image API 1.1 Tile Source (#230)
|
* Added IIIF Image API 1.1 Tile Source (#230)
|
||||||
|
* Fixed: Touch event issue where no canvas-click events were being raised (#240)
|
||||||
|
|
||||||
0.9.131:
|
0.9.131:
|
||||||
|
|
||||||
|
@ -152,13 +152,13 @@ $.Button = function( options ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.addHandler( "onPress", this.onPress );
|
this.addHandler( "press", this.onPress );
|
||||||
this.addHandler( "onRelease", this.onRelease );
|
this.addHandler( "release", this.onRelease );
|
||||||
this.addHandler( "onClick", this.onClick );
|
this.addHandler( "click", this.onClick );
|
||||||
this.addHandler( "onEnter", this.onEnter );
|
this.addHandler( "enter", this.onEnter );
|
||||||
this.addHandler( "onExit", this.onExit );
|
this.addHandler( "exit", this.onExit );
|
||||||
this.addHandler( "onFocus", this.onFocus );
|
this.addHandler( "focus", this.onFocus );
|
||||||
this.addHandler( "onBlur", this.onBlur );
|
this.addHandler( "blur", this.onBlur );
|
||||||
|
|
||||||
this.currentState = $.ButtonState.GROUP;
|
this.currentState = $.ButtonState.GROUP;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ $.Button = function( options ) {
|
|||||||
enterHandler: function( tracker, eventData ) {
|
enterHandler: function( tracker, eventData ) {
|
||||||
if ( eventData.insideElementPressed ) {
|
if ( eventData.insideElementPressed ) {
|
||||||
inTo( _this, $.ButtonState.DOWN );
|
inTo( _this, $.ButtonState.DOWN );
|
||||||
_this.raiseEvent( "onEnter", _this );
|
_this.raiseEvent( "enter", _this );
|
||||||
} else if ( !eventData.buttonDownAny ) {
|
} else if ( !eventData.buttonDownAny ) {
|
||||||
inTo( _this, $.ButtonState.HOVER );
|
inTo( _this, $.ButtonState.HOVER );
|
||||||
}
|
}
|
||||||
@ -186,30 +186,30 @@ $.Button = function( options ) {
|
|||||||
|
|
||||||
focusHandler: function ( tracker, eventData ) {
|
focusHandler: function ( tracker, eventData ) {
|
||||||
this.enterHandler( tracker, eventData );
|
this.enterHandler( tracker, eventData );
|
||||||
_this.raiseEvent( "onFocus", _this );
|
_this.raiseEvent( "focus", _this );
|
||||||
},
|
},
|
||||||
|
|
||||||
exitHandler: function( tracker, eventData ) {
|
exitHandler: function( tracker, eventData ) {
|
||||||
outTo( _this, $.ButtonState.GROUP );
|
outTo( _this, $.ButtonState.GROUP );
|
||||||
if ( eventData.insideElementPressed ) {
|
if ( eventData.insideElementPressed ) {
|
||||||
_this.raiseEvent( "onExit", _this );
|
_this.raiseEvent( "exit", _this );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
blurHandler: function ( tracker, eventData ) {
|
blurHandler: function ( tracker, eventData ) {
|
||||||
this.exitHandler( tracker, eventData );
|
this.exitHandler( tracker, eventData );
|
||||||
_this.raiseEvent( "onBlur", _this );
|
_this.raiseEvent( "blur", _this );
|
||||||
},
|
},
|
||||||
|
|
||||||
pressHandler: function ( tracker, eventData ) {
|
pressHandler: function ( tracker, eventData ) {
|
||||||
inTo( _this, $.ButtonState.DOWN );
|
inTo( _this, $.ButtonState.DOWN );
|
||||||
_this.raiseEvent( "onPress", _this );
|
_this.raiseEvent( "press", _this );
|
||||||
},
|
},
|
||||||
|
|
||||||
releaseHandler: function( tracker, eventData ) {
|
releaseHandler: function( tracker, eventData ) {
|
||||||
if ( eventData.insideElementPressed && eventData.insideElementReleased ) {
|
if ( eventData.insideElementPressed && eventData.insideElementReleased ) {
|
||||||
outTo( _this, $.ButtonState.HOVER );
|
outTo( _this, $.ButtonState.HOVER );
|
||||||
_this.raiseEvent( "onRelease", _this );
|
_this.raiseEvent( "release", _this );
|
||||||
} else if ( eventData.insideElementPressed ) {
|
} else if ( eventData.insideElementPressed ) {
|
||||||
outTo( _this, $.ButtonState.GROUP );
|
outTo( _this, $.ButtonState.GROUP );
|
||||||
} else {
|
} else {
|
||||||
@ -219,15 +219,15 @@ $.Button = function( options ) {
|
|||||||
|
|
||||||
clickHandler: function( tracker, eventData ) {
|
clickHandler: function( tracker, eventData ) {
|
||||||
if ( eventData.quick ) {
|
if ( eventData.quick ) {
|
||||||
_this.raiseEvent("onClick", _this);
|
_this.raiseEvent("click", _this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
keyHandler: function( tracker, eventData ){
|
keyHandler: function( tracker, eventData ){
|
||||||
//console.log( "%s : handling key %s!", _this.tooltip, eventData.keyCode);
|
//console.log( "%s : handling key %s!", _this.tooltip, eventData.keyCode);
|
||||||
if( 13 === eventData.keyCode ){
|
if( 13 === eventData.keyCode ){
|
||||||
_this.raiseEvent( "onClick", _this );
|
_this.raiseEvent( "click", _this );
|
||||||
_this.raiseEvent( "onRelease", _this );
|
_this.raiseEvent( "release", _this );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,12 +36,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* For use by classes which want to support custom, non-browser events.
|
* For use by classes which want to support custom, non-browser events.
|
||||||
* TODO: This is an awful name! This thing represents an "event source",
|
* TODO: Add a method 'one' which automatically unbinds a listener after
|
||||||
* not an "event handler". PLEASE change the to EventSource. Also please
|
* the first triggered event that matches.
|
||||||
* change 'addHandler', 'removeHandler' and 'raiseEvent' to 'bind',
|
|
||||||
* 'unbind', and 'trigger' respectively. Finally add a method 'one' which
|
|
||||||
* automatically unbinds a listener after the first triggered event that
|
|
||||||
* matches.
|
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
$.EventSource = function() {
|
$.EventSource = function() {
|
||||||
|
163
src/iiif1_1tilesource.js
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* OpenSeadragon - IIIF1_1TileSource
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 CodePlex Foundation
|
||||||
|
* Copyright (C) 2010-2013 OpenSeadragon contributors
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* - Neither the name of CodePlex Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function( $ ){
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A client implementation of the International Image Interoperability
|
||||||
|
* Format: Image API 1.1 - Please read more about the specification
|
||||||
|
* at
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @extends OpenSeadragon.TileSource
|
||||||
|
* @see http://library.stanford.edu/iiif/image-api/
|
||||||
|
*/
|
||||||
|
$.IIIF1_1TileSource = function( options ){
|
||||||
|
|
||||||
|
$.extend( true, this, options );
|
||||||
|
|
||||||
|
if( !(this.height && this.width && this['@id'] ) ){
|
||||||
|
throw new Error('IIIF required parameters not provided.');
|
||||||
|
}
|
||||||
|
|
||||||
|
options.tileSize = this.tile_width;
|
||||||
|
|
||||||
|
if (! options.maxLevel ) {
|
||||||
|
var mf = -1;
|
||||||
|
var scfs = this.scale_factors || this.scale_factor;
|
||||||
|
if ( scfs instanceof Array ) {
|
||||||
|
for ( var i = 0; i < scfs.length; i++ ) {
|
||||||
|
var cf = Number( scfs[i] );
|
||||||
|
if ( !isNaN( cf ) && cf > mf ) { mf = cf; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( mf < 0 ) { options.maxLevel = Number(Math.ceil(Math.log(Math.max(this.width, this.height), 2))); }
|
||||||
|
else { options.maxLevel = mf; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$.TileSource.apply( this, [ options ] );
|
||||||
|
};
|
||||||
|
|
||||||
|
$.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, {
|
||||||
|
/**
|
||||||
|
* Determine if the data and/or url imply the image service is supported by
|
||||||
|
* this tile source.
|
||||||
|
* @function
|
||||||
|
* @name OpenSeadragon.IIIF1_1TileSource.prototype.supports
|
||||||
|
* @param {Object|Array} data
|
||||||
|
* @param {String} optional - url
|
||||||
|
*/
|
||||||
|
supports: function( data, url ){
|
||||||
|
return data.profile && (
|
||||||
|
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" == data.profile ||
|
||||||
|
"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#level3" == data.profile ||
|
||||||
|
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html" == data.profile
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
* @name OpenSeadragon.IIIF1_1TileSource.prototype.configure
|
||||||
|
* @param {Object} data - the raw configuration
|
||||||
|
*/
|
||||||
|
// IIIF 1.1 Info Looks like this (XML syntax is no more):
|
||||||
|
// {
|
||||||
|
// "@context" : "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
|
// "@id" : "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C",
|
||||||
|
// "width" : 6000,
|
||||||
|
// "height" : 4000,
|
||||||
|
// "scale_factors" : [ 1, 2, 4 ],
|
||||||
|
// "tile_width" : 1024,
|
||||||
|
// "tile_height" : 1024,
|
||||||
|
// "formats" : [ "jpg", "png" ],
|
||||||
|
// "qualities" : [ "native", "grey" ]
|
||||||
|
// "profile" : "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0"
|
||||||
|
// }
|
||||||
|
configure: function( data ){
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Responsible for retreiving the url which will return an image for the
|
||||||
|
* region specified by the given x, y, and level components.
|
||||||
|
* @function
|
||||||
|
* @name OpenSeadragon.IIIF1_1TileSource.prototype.getTileUrl
|
||||||
|
* @param {Number} level - z index
|
||||||
|
* @param {Number} x
|
||||||
|
* @param {Number} y
|
||||||
|
* @throws {Error}
|
||||||
|
*/
|
||||||
|
getTileUrl: function( level, x, y ){
|
||||||
|
|
||||||
|
//# constants
|
||||||
|
var IIIF_ROTATION = '0',
|
||||||
|
IIIF_QUALITY = 'native.jpg',
|
||||||
|
|
||||||
|
//## get the scale (level as a decimal)
|
||||||
|
scale = Math.pow( 0.5, this.maxLevel - level ),
|
||||||
|
|
||||||
|
//# image dimensions at this level
|
||||||
|
level_width = Math.ceil( this.width * scale ),
|
||||||
|
level_height = Math.ceil( this.height * scale ),
|
||||||
|
|
||||||
|
//## iiif region
|
||||||
|
iiif_tile_size_width = Math.ceil( this.tileSize / scale ),
|
||||||
|
iiif_tile_size_height = Math.ceil( this.tileSize / scale ),
|
||||||
|
iiif_region,
|
||||||
|
iiif_tile_x,
|
||||||
|
iiif_tile_y,
|
||||||
|
iiif_tile_w,
|
||||||
|
iiif_tile_h,
|
||||||
|
iiif_size,
|
||||||
|
uri;
|
||||||
|
|
||||||
|
if ( level_width < this.tile_width && level_height < this.tile_height ){
|
||||||
|
iiif_size = level_width + "," + level_height;
|
||||||
|
iiif_region = 'full';
|
||||||
|
} else {
|
||||||
|
iiif_tile_x = x * iiif_tile_size_width;
|
||||||
|
iiif_tile_y = y * iiif_tile_size_height;
|
||||||
|
iiif_tile_w = Math.min( iiif_tile_size_width, this.width - iiif_tile_x );
|
||||||
|
iiif_tile_h = Math.min( iiif_tile_size_height, this.height - iiif_tile_y );
|
||||||
|
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(',');
|
||||||
|
}
|
||||||
|
uri = [ this['@id'], iiif_region, iiif_size, IIIF_ROTATION, IIIF_QUALITY ].join('/');
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}( OpenSeadragon ));
|
@ -1020,7 +1020,7 @@
|
|||||||
function onMouseUpCaptured( tracker, event, noRelease, isTouch ) {
|
function onMouseUpCaptured( tracker, event, noRelease, isTouch ) {
|
||||||
isTouch = isTouch || false;
|
isTouch = isTouch || false;
|
||||||
|
|
||||||
if ( !THIS[ tracker.hash ].insideElement ) {
|
if ( !THIS[ tracker.hash ].insideElement || isTouch ) {
|
||||||
onMouseUp( tracker, event, isTouch );
|
onMouseUp( tracker, event, isTouch );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ var I18N = {
|
|||||||
Security: "It looks like a security restriction stopped us from " +
|
Security: "It looks like a security restriction stopped us from " +
|
||||||
"loading this Deep Zoom Image.",
|
"loading this Deep Zoom Image.",
|
||||||
Status: "This space unintentionally left blank ({0} {1}).",
|
Status: "This space unintentionally left blank ({0} {1}).",
|
||||||
"Open-Failed": "Unable to open {0}: {1}"
|
OpenFailed: "Unable to open {0}: {1}"
|
||||||
},
|
},
|
||||||
|
|
||||||
Tooltips: {
|
Tooltips: {
|
||||||
|
@ -117,15 +117,8 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
|
|||||||
for ( i = 0; i < arguments.length; i++ ) {
|
for ( i = 0; i < arguments.length; i++ ) {
|
||||||
if ( $.isFunction( arguments[ i ] ) ) {
|
if ( $.isFunction( arguments[ i ] ) ) {
|
||||||
callback = arguments[ i ];
|
callback = arguments[ i ];
|
||||||
// TODO Send generic object wrapping readySource as a property (breaking change)
|
this.addHandler( 'ready', function ( placeHolderSource, placeHolderEventData ) {
|
||||||
// TODO Maybe placeHolderSource should be passed to callback as well for consistency
|
callback( placeHolderSource, placeHolderEventData );
|
||||||
// with event handler signature?
|
|
||||||
// Should be this (although technically it works as-is):
|
|
||||||
//this.addHandler( 'ready', function ( placeHolderSource, placeHolderArgs ) {
|
|
||||||
// callback( placeHolderArgs );
|
|
||||||
//} );
|
|
||||||
this.addHandler( 'ready', function ( placeHolderSource, readySource ) {
|
|
||||||
callback( readySource );
|
|
||||||
} );
|
} );
|
||||||
//only one callback per constructor
|
//only one callback per constructor
|
||||||
break;
|
break;
|
||||||
@ -308,10 +301,7 @@ $.TileSource.prototype = {
|
|||||||
options = $TileSource.prototype.configure.apply( _this, [ data, url ]);
|
options = $TileSource.prototype.configure.apply( _this, [ data, url ]);
|
||||||
readySource = new $TileSource( options );
|
readySource = new $TileSource( options );
|
||||||
_this.ready = true;
|
_this.ready = true;
|
||||||
// TODO Send generic object wrapping readySource as a property (breaking change)
|
_this.raiseEvent( 'ready', { tileSource: readySource } );
|
||||||
// Should be this:
|
|
||||||
//_this.raiseEvent( 'ready', { tileSource: readySource } );
|
|
||||||
_this.raiseEvent( 'ready', readySource );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( url.match(/\.js$/) ){
|
if( url.match(/\.js$/) ){
|
||||||
|
@ -173,7 +173,7 @@ $.Viewer = function( options ) {
|
|||||||
$.EventSource.call( this );
|
$.EventSource.call( this );
|
||||||
|
|
||||||
this.addHandler( 'open-failed', function (source, args) {
|
this.addHandler( 'open-failed', function (source, args) {
|
||||||
var msg = $.getString( "Errors.Open-Failed", args.source, args.message);
|
var msg = $.getString( "Errors.OpenFailed", args.source, args.message);
|
||||||
_this._showMessage( msg );
|
_this._showMessage( msg );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -438,8 +438,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
if ( $.type( tileSource ) == 'string') {
|
if ( $.type( tileSource ) == 'string') {
|
||||||
//If its still a string it means it must be a url at this point
|
//If its still a string it means it must be a url at this point
|
||||||
tileSource = new $.TileSource( tileSource, function( readySource ){
|
tileSource = new $.TileSource( tileSource, function( eventSource, eventData ){
|
||||||
openTileSource( _this, readySource );
|
openTileSource( _this, eventData.tileSource );
|
||||||
});
|
});
|
||||||
tileSource.addHandler( 'open-failed', function ( name, args ) {
|
tileSource.addHandler( 'open-failed', function ( name, args ) {
|
||||||
_this.raiseEvent( 'open-failed', args );
|
_this.raiseEvent( 'open-failed', args );
|
||||||
@ -1589,7 +1589,7 @@ function updateOnce( viewer ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !THIS[ viewer.hash ].animating && animated ) {
|
if ( !THIS[ viewer.hash ].animating && animated ) {
|
||||||
viewer.raiseEvent( "animationstart" );
|
viewer.raiseEvent( "animation-start" );
|
||||||
abortControlsAutoHide( viewer );
|
abortControlsAutoHide( viewer );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1608,7 +1608,7 @@ function updateOnce( viewer ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( THIS[ viewer.hash ].animating && !animated ) {
|
if ( THIS[ viewer.hash ].animating && !animated ) {
|
||||||
viewer.raiseEvent( "animationfinish" );
|
viewer.raiseEvent( "animation-finish" );
|
||||||
|
|
||||||
if ( !THIS[ viewer.hash ].mouseInside ) {
|
if ( !THIS[ viewer.hash ].mouseInside ) {
|
||||||
beginControlsAutoHide( viewer );
|
beginControlsAutoHide( viewer );
|
||||||
|
@ -73,12 +73,12 @@
|
|||||||
equal(viewport.getZoom(), 1, 'We start out unzoomed');
|
equal(viewport.getZoom(), 1, 'We start out unzoomed');
|
||||||
|
|
||||||
var zoomHandler = function() {
|
var zoomHandler = function() {
|
||||||
viewer.removeHandler('animationfinish', zoomHandler);
|
viewer.removeHandler('animation-finish', zoomHandler);
|
||||||
equal(viewport.getZoom(), 2, 'Zoomed correctly');
|
equal(viewport.getZoom(), 2, 'Zoomed correctly');
|
||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
|
|
||||||
viewer.addHandler('animationfinish', zoomHandler);
|
viewer.addHandler('animation-finish', zoomHandler);
|
||||||
viewport.zoomTo(2);
|
viewport.zoomTo(2);
|
||||||
});
|
});
|
||||||
viewer.open('/test/data/testpattern.dzi');
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
@ -93,13 +93,13 @@
|
|||||||
ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned');
|
ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned');
|
||||||
|
|
||||||
var panHandler = function() {
|
var panHandler = function() {
|
||||||
viewer.removeHandler('animationfinish', panHandler);
|
viewer.removeHandler('animation-finish', panHandler);
|
||||||
center = viewport.getCenter();
|
center = viewport.getCenter();
|
||||||
ok(center.x === 0.1 && center.y === 0.1, 'Panned correctly');
|
ok(center.x === 0.1 && center.y === 0.1, 'Panned correctly');
|
||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
|
|
||||||
viewer.addHandler('animationfinish', panHandler);
|
viewer.addHandler('animation-finish', panHandler);
|
||||||
viewport.panTo(new OpenSeadragon.Point(0.1, 0.1));
|
viewport.panTo(new OpenSeadragon.Point(0.1, 0.1));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -119,25 +119,25 @@
|
|||||||
var viewport = viewer.viewport,
|
var viewport = viewer.viewport,
|
||||||
center = viewport.getCenter();
|
center = viewport.getCenter();
|
||||||
|
|
||||||
viewer.removeHandler('animationfinish', stage1);
|
viewer.removeHandler('animation-finish', stage1);
|
||||||
|
|
||||||
ok(center.x !== 0.5 && center.y !== 0.5, 'We start out panned');
|
ok(center.x !== 0.5 && center.y !== 0.5, 'We start out panned');
|
||||||
notEqual(viewport.getZoom(), 1, 'We start out zoomed');
|
notEqual(viewport.getZoom(), 1, 'We start out zoomed');
|
||||||
|
|
||||||
var homeHandler = function() {
|
var homeHandler = function() {
|
||||||
viewer.removeHandler('animationfinish', homeHandler);
|
viewer.removeHandler('animation-finish', homeHandler);
|
||||||
center = viewport.getCenter();
|
center = viewport.getCenter();
|
||||||
ok(center.x === 0.5 && center.y === 0.5, 'We end up unpanned');
|
ok(center.x === 0.5 && center.y === 0.5, 'We end up unpanned');
|
||||||
equal(viewport.getZoom(), 1, 'We end up unzoomed');
|
equal(viewport.getZoom(), 1, 'We end up unzoomed');
|
||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
|
|
||||||
viewer.addHandler('animationfinish', homeHandler);
|
viewer.addHandler('animation-finish', homeHandler);
|
||||||
viewport.goHome(true);
|
viewport.goHome(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.addHandler("open", opener);
|
viewer.addHandler("open", opener);
|
||||||
viewer.addHandler("animationfinish", stage1);
|
viewer.addHandler("animation-finish", stage1);
|
||||||
|
|
||||||
viewer.open('/test/data/testpattern.dzi');
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
});
|
});
|
||||||
@ -152,14 +152,14 @@
|
|||||||
equal(viewport.getZoom(), 1, 'We start out unzoomed');
|
equal(viewport.getZoom(), 1, 'We start out unzoomed');
|
||||||
|
|
||||||
var clickHandler = function() {
|
var clickHandler = function() {
|
||||||
viewer.removeHandler('animationfinish', clickHandler);
|
viewer.removeHandler('animation-finish', clickHandler);
|
||||||
center = viewport.getCenter();
|
center = viewport.getCenter();
|
||||||
ok(center.x > 0.37 && center.x < 0.38 && center.y > 0.37 && center.y < 0.38, 'Panned correctly');
|
ok(center.x > 0.37 && center.x < 0.38 && center.y > 0.37 && center.y < 0.38, 'Panned correctly');
|
||||||
equal(viewport.getZoom(), 2, 'Zoomed correctly');
|
equal(viewport.getZoom(), 2, 'Zoomed correctly');
|
||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
|
|
||||||
viewer.addHandler('animationfinish', clickHandler);
|
viewer.addHandler('animation-finish', clickHandler);
|
||||||
Util.simulateViewerClickWithDrag( {
|
Util.simulateViewerClickWithDrag( {
|
||||||
viewer: viewer,
|
viewer: viewer,
|
||||||
widthFactor: 0.25,
|
widthFactor: 0.25,
|
||||||
|
26
test/data/iiif1_0.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"identifier": "iiif_1_0_files",
|
||||||
|
"width": 775,
|
||||||
|
"height": 1024,
|
||||||
|
"scale_factors": [
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6
|
||||||
|
],
|
||||||
|
"tile_width": 256,
|
||||||
|
"tile_height": 256,
|
||||||
|
"formats": [
|
||||||
|
"jpg",
|
||||||
|
"png"
|
||||||
|
],
|
||||||
|
"qualities": [
|
||||||
|
"native",
|
||||||
|
"bitonal",
|
||||||
|
"grey",
|
||||||
|
"color"
|
||||||
|
],
|
||||||
|
"profile": "http://library.stanford.edu/iiif/image-api/compliance.html#level1"
|
||||||
|
}
|
26
test/data/iiif1_0.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<info xmlns="http://library.stanford.edu/iiif/image-api/ns/">
|
||||||
|
<identifier>iiif_1_0_files</identifier>
|
||||||
|
<width>775</width>
|
||||||
|
<height>1024</height>
|
||||||
|
<scale_factors>
|
||||||
|
<scale_factor>1</scale_factor>
|
||||||
|
<scale_factor>2</scale_factor>
|
||||||
|
<scale_factor>3</scale_factor>
|
||||||
|
<scale_factor>4</scale_factor>
|
||||||
|
<scale_factor>5</scale_factor>
|
||||||
|
<scale_factor>6</scale_factor>
|
||||||
|
</scale_factors>
|
||||||
|
<tile_width>256</tile_width>
|
||||||
|
<tile_height>256</tile_height>
|
||||||
|
<formats>
|
||||||
|
<format>jpg</format>
|
||||||
|
<format>png</format>
|
||||||
|
</formats>
|
||||||
|
<qualities>
|
||||||
|
<quality>native</quality>
|
||||||
|
<quality>bitonal</quality>
|
||||||
|
<quality>grey</quality>
|
||||||
|
<quality>color</quality>
|
||||||
|
</qualities>
|
||||||
|
<profile>http://library.stanford.edu/iiif/image-api/compliance.html#level1</profile>
|
||||||
|
</info>
|
28
test/data/iiif1_1.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",
|
||||||
|
"scale_factors": [
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
4,
|
||||||
|
8,
|
||||||
|
16,
|
||||||
|
32
|
||||||
|
],
|
||||||
|
"tile_height": 256,
|
||||||
|
"height": 1024,
|
||||||
|
"width": 775,
|
||||||
|
"tile_width": 256,
|
||||||
|
"qualities": [
|
||||||
|
"native",
|
||||||
|
"bitonal",
|
||||||
|
"grey",
|
||||||
|
"color"
|
||||||
|
],
|
||||||
|
"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_files"
|
||||||
|
}
|
BIN
test/data/iiif_1_0_files/0,0,1024,1024/pct:25/0/native.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
test/data/iiif_1_0_files/0,0,2048,2048/pct:12.5/0/native.jpg
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
test/data/iiif_1_0_files/0,0,512,512/pct:50/0/native.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
test/data/iiif_1_0_files/0,0,775,1024/pct:25/0/native.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
test/data/iiif_1_0_files/0,512,512,512/pct:50/0/native.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
test/data/iiif_1_0_files/512,0,263,512/pct:50/0/native.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_1_0_files/512,512,263,512/pct:50/0/native.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
test/data/iiif_1_0_files/full/pct:1.5625/0/native.jpg
Normal file
After Width: | Height: | Size: 426 B |
BIN
test/data/iiif_1_0_files/full/pct:12.5/0/native.jpg
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
test/data/iiif_1_0_files/full/pct:3.125/0/native.jpg
Normal file
After Width: | Height: | Size: 696 B |
BIN
test/data/iiif_1_0_files/full/pct:6.25/0/native.jpg
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
test/data/iiif_1_1_files/0,0,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
test/data/iiif_1_1_files/0,0,512,512/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
test/data/iiif_1_1_files/0,0,512,512/256,256/0/native.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
test/data/iiif_1_1_files/0,0,775,1024/194,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
test/data/iiif_1_1_files/0,0,775,1024/194,256/0/native.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
test/data/iiif_1_1_files/0,256,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
test/data/iiif_1_1_files/0,512,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
test/data/iiif_1_1_files/0,512,512,512/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
test/data/iiif_1_1_files/0,512,512,512/256,256/0/native.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
test/data/iiif_1_1_files/0,768,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_1_1_files/0,768,256,256/256,256/0/native.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_1_1_files/256,0,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
test/data/iiif_1_1_files/256,256,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
test/data/iiif_1_1_files/256,512,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
test/data/iiif_1_1_files/256,768,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
test/data/iiif_1_1_files/512,0,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
test/data/iiif_1_1_files/512,0,263,512/132,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_1_1_files/512,0,263,512/132,256/0/native.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_1_1_files/512,256,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
test/data/iiif_1_1_files/512,512,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
test/data/iiif_1_1_files/512,512,263,512/132,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
test/data/iiif_1_1_files/512,512,263,512/132,256/0/native.jpg
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
test/data/iiif_1_1_files/512,768,256,256/256,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/data/iiif_1_1_files/768,0,7,256/7,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 717 B |
BIN
test/data/iiif_1_1_files/768,256,7,256/7,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 716 B |
BIN
test/data/iiif_1_1_files/768,512,7,256/7,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 717 B |
BIN
test/data/iiif_1_1_files/768,768,7,256/7,256/0/b0.jpg
Normal file
After Width: | Height: | Size: 712 B |
BIN
test/data/iiif_1_1_files/full/1,1/0/b0.jpg
Normal file
After Width: | Height: | Size: 633 B |
BIN
test/data/iiif_1_1_files/full/1,1/0/native.jpg
Normal file
After Width: | Height: | Size: 633 B |
BIN
test/data/iiif_1_1_files/full/13,16/0/b0.jpg
Normal file
After Width: | Height: | Size: 810 B |
BIN
test/data/iiif_1_1_files/full/13,16/0/native.jpg
Normal file
After Width: | Height: | Size: 810 B |
BIN
test/data/iiif_1_1_files/full/2,2/0/b0.jpg
Normal file
After Width: | Height: | Size: 663 B |
BIN
test/data/iiif_1_1_files/full/2,2/0/native.jpg
Normal file
After Width: | Height: | Size: 663 B |
BIN
test/data/iiif_1_1_files/full/25,32/0/b0.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
test/data/iiif_1_1_files/full/25,32/0/native.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
test/data/iiif_1_1_files/full/4,4/0/b0.jpg
Normal file
After Width: | Height: | Size: 675 B |
BIN
test/data/iiif_1_1_files/full/4,4/0/native.jpg
Normal file
After Width: | Height: | Size: 675 B |
BIN
test/data/iiif_1_1_files/full/49,64/0/b0.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
test/data/iiif_1_1_files/full/49,64/0/native.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
test/data/iiif_1_1_files/full/7,8/0/b0.jpg
Normal file
After Width: | Height: | Size: 683 B |
BIN
test/data/iiif_1_1_files/full/7,8/0/native.jpg
Normal file
After Width: | Height: | Size: 683 B |
BIN
test/data/iiif_1_1_files/full/97,128/0/b0.jpg
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
test/data/iiif_1_1_files/full/97,128/0/native.jpg
Normal file
After Width: | Height: | Size: 7.1 KiB |
@ -65,4 +65,19 @@
|
|||||||
testOpen('testpattern.xml');
|
testOpen('testpattern.xml');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF 1.0 JSON', function() {
|
||||||
|
testOpen('iiif1_0.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF 1.0 XML', function() {
|
||||||
|
testOpen('iiif1_0.xml');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF 1.1 JSON', function() {
|
||||||
|
testOpen('iiif1_1.json');
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("getStringWithPlaceholders", function() {
|
test("getStringWithPlaceholders", function() {
|
||||||
equal(OpenSeadragon.getString("Errors.Open-Failed", "foo", "bar"),
|
equal(OpenSeadragon.getString("Errors.OpenFailed", "foo", "bar"),
|
||||||
"Unable to open foo: bar",
|
"Unable to open foo: bar",
|
||||||
"String placeholder replacement");
|
"String placeholder replacement");
|
||||||
});
|
});
|
||||||
|