mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 22:56:11 +03:00
Merge pull request #15 from Ventero/imageload
Pass the correct object to image load callbacks.
This commit is contained in:
commit
d23851d5e5
@ -8181,9 +8181,9 @@ $.Drawer.prototype = {
|
|||||||
* @method
|
* @method
|
||||||
* @param {String} src - The url of the image to load.
|
* @param {String} src - The url of the image to load.
|
||||||
* @param {Function} callback - The function that will be called with the
|
* @param {Function} callback - The function that will be called with the
|
||||||
* Image object as the only parameter, whether on 'load' or on 'abort'.
|
* Image object as the only parameter if it was loaded successfully.
|
||||||
* For now this means the callback is expected to distinguish between
|
* If an error occured, or the request timed out or was aborted,
|
||||||
* error and success conditions by inspecting the Image object.
|
* the parameter is null instead.
|
||||||
* @return {Boolean} loading - Wheter the request was submitted or ignored
|
* @return {Boolean} loading - Wheter the request was submitted or ignored
|
||||||
* based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit.
|
* based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit.
|
||||||
*/
|
*/
|
||||||
@ -8201,11 +8201,11 @@ $.Drawer.prototype = {
|
|||||||
|
|
||||||
image = new Image();
|
image = new Image();
|
||||||
|
|
||||||
complete = function( imagesrc ){
|
complete = function( imagesrc, resultingImage ){
|
||||||
_this.downloading--;
|
_this.downloading--;
|
||||||
if (typeof ( callback ) == "function") {
|
if (typeof ( callback ) == "function") {
|
||||||
try {
|
try {
|
||||||
callback( image );
|
callback( resultingImage );
|
||||||
} catch ( e ) {
|
} catch ( e ) {
|
||||||
$.console.error(
|
$.console.error(
|
||||||
"%s while executing %s callback: %s",
|
"%s while executing %s callback: %s",
|
||||||
@ -8219,11 +8219,11 @@ $.Drawer.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
image.onload = function(){
|
image.onload = function(){
|
||||||
finishLoadingImage( image, complete, true );
|
finishLoadingImage( image, complete, true, jobid );
|
||||||
};
|
};
|
||||||
|
|
||||||
image.onabort = image.onerror = function(){
|
image.onabort = image.onerror = function(){
|
||||||
finishLoadingImage( image, complete, false );
|
finishLoadingImage( image, complete, false, jobid );
|
||||||
};
|
};
|
||||||
|
|
||||||
jobid = window.setTimeout( function(){
|
jobid = window.setTimeout( function(){
|
||||||
|
@ -275,9 +275,9 @@ $.Drawer.prototype = {
|
|||||||
* @method
|
* @method
|
||||||
* @param {String} src - The url of the image to load.
|
* @param {String} src - The url of the image to load.
|
||||||
* @param {Function} callback - The function that will be called with the
|
* @param {Function} callback - The function that will be called with the
|
||||||
* Image object as the only parameter, whether on 'load' or on 'abort'.
|
* Image object as the only parameter if it was loaded successfully.
|
||||||
* For now this means the callback is expected to distinguish between
|
* If an error occured, or the request timed out or was aborted,
|
||||||
* error and success conditions by inspecting the Image object.
|
* the parameter is null instead.
|
||||||
* @return {Boolean} loading - Wheter the request was submitted or ignored
|
* @return {Boolean} loading - Wheter the request was submitted or ignored
|
||||||
* based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit.
|
* based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit.
|
||||||
*/
|
*/
|
||||||
@ -295,11 +295,11 @@ $.Drawer.prototype = {
|
|||||||
|
|
||||||
image = new Image();
|
image = new Image();
|
||||||
|
|
||||||
complete = function( imagesrc ){
|
complete = function( imagesrc, resultingImage ){
|
||||||
_this.downloading--;
|
_this.downloading--;
|
||||||
if (typeof ( callback ) == "function") {
|
if (typeof ( callback ) == "function") {
|
||||||
try {
|
try {
|
||||||
callback( image );
|
callback( resultingImage );
|
||||||
} catch ( e ) {
|
} catch ( e ) {
|
||||||
$.console.error(
|
$.console.error(
|
||||||
"%s while executing %s callback: %s",
|
"%s while executing %s callback: %s",
|
||||||
@ -313,11 +313,11 @@ $.Drawer.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
image.onload = function(){
|
image.onload = function(){
|
||||||
finishLoadingImage( image, complete, true );
|
finishLoadingImage( image, complete, true, jobid );
|
||||||
};
|
};
|
||||||
|
|
||||||
image.onabort = image.onerror = function(){
|
image.onabort = image.onerror = function(){
|
||||||
finishLoadingImage( image, complete, false );
|
finishLoadingImage( image, complete, false, jobid );
|
||||||
};
|
};
|
||||||
|
|
||||||
jobid = window.setTimeout( function(){
|
jobid = window.setTimeout( function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user