Merge pull request #15 from Ventero/imageload

Pass the correct object to image load callbacks.
This commit is contained in:
iangilman 2013-01-28 10:21:36 -08:00
commit d23851d5e5
2 changed files with 16 additions and 16 deletions

View File

@ -8181,9 +8181,9 @@ $.Drawer.prototype = {
* @method
* @param {String} src - The url of the image to load.
* @param {Function} callback - The function that will be called with the
* Image object as the only parameter, whether on 'load' or on 'abort'.
* For now this means the callback is expected to distinguish between
* error and success conditions by inspecting the Image object.
* Image object as the only parameter if it was loaded successfully.
* If an error occured, or the request timed out or was aborted,
* the parameter is null instead.
* @return {Boolean} loading - Wheter the request was submitted or ignored
* based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit.
*/
@ -8201,11 +8201,11 @@ $.Drawer.prototype = {
image = new Image();
complete = function( imagesrc ){
complete = function( imagesrc, resultingImage ){
_this.downloading--;
if (typeof ( callback ) == "function") {
try {
callback( image );
callback( resultingImage );
} catch ( e ) {
$.console.error(
"%s while executing %s callback: %s",
@ -8219,11 +8219,11 @@ $.Drawer.prototype = {
};
image.onload = function(){
finishLoadingImage( image, complete, true );
finishLoadingImage( image, complete, true, jobid );
};
image.onabort = image.onerror = function(){
finishLoadingImage( image, complete, false );
finishLoadingImage( image, complete, false, jobid );
};
jobid = window.setTimeout( function(){

View File

@ -275,9 +275,9 @@ $.Drawer.prototype = {
* @method
* @param {String} src - The url of the image to load.
* @param {Function} callback - The function that will be called with the
* Image object as the only parameter, whether on 'load' or on 'abort'.
* For now this means the callback is expected to distinguish between
* error and success conditions by inspecting the Image object.
* Image object as the only parameter if it was loaded successfully.
* If an error occured, or the request timed out or was aborted,
* the parameter is null instead.
* @return {Boolean} loading - Wheter the request was submitted or ignored
* based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit.
*/
@ -295,11 +295,11 @@ $.Drawer.prototype = {
image = new Image();
complete = function( imagesrc ){
complete = function( imagesrc, resultingImage ){
_this.downloading--;
if (typeof ( callback ) == "function") {
try {
callback( image );
callback( resultingImage );
} catch ( e ) {
$.console.error(
"%s while executing %s callback: %s",
@ -313,11 +313,11 @@ $.Drawer.prototype = {
};
image.onload = function(){
finishLoadingImage( image, complete, true );
finishLoadingImage( image, complete, true, jobid );
};
image.onabort = image.onerror = function(){
finishLoadingImage( image, complete, false );
finishLoadingImage( image, complete, false, jobid );
};
jobid = window.setTimeout( function(){