From dd8baa16398309b5315a91ea569a2bfe718c53c1 Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Fri, 11 Sep 2015 14:24:22 -0600 Subject: [PATCH 1/2] Added 'tile-open-failed' event to notify the app when a tile fails to load. This can happen when the image has authentication or other restrictions. --- src/tiledimage.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tiledimage.js b/src/tiledimage.js index 4aaef1db..70772292 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1023,6 +1023,18 @@ function loadTile( tiledImage, tile, time ) { function onTileLoad( tiledImage, tile, time, image, errorMsg ) { if ( !image ) { $.console.log( "Tile %s failed to load: %s - error: %s", tile, tile.url, errorMsg ); + /** + * Triggered when a tile fails to load. + * + * @event tile-open-failed + * @memberof OpenSeadragon.Viewer + * @type {object} + * @property {OpenSeadragon.TiledImage} tiledImage - The tiled image of the unloaded tile. + * @property {OpenSeadragon.Tile} tile - The tile which has been unloaded. + * @property {number} time - The current time in milliseconds when the tile load began. + * @property {string} message - The error message. + */ + tiledImage.viewer.raiseEvent("tile-open-failed", {tile: tile, tiledImage: tiledImage, time: time, message: errorMsg}); if( !tiledImage.debugMode ){ tile.loading = false; tile.exists = false; From 4b3bfcb7037e4e163d48b30192f296ce8bfa0150 Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Mon, 14 Sep 2015 15:25:30 -0600 Subject: [PATCH 2/2] Cleaned up comments and renamed the event as per Ian's request to 'tile-load-failed' --- src/tiledimage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index 70772292..a1832831 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1030,11 +1030,11 @@ function onTileLoad( tiledImage, tile, time, image, errorMsg ) { * @memberof OpenSeadragon.Viewer * @type {object} * @property {OpenSeadragon.TiledImage} tiledImage - The tiled image of the unloaded tile. - * @property {OpenSeadragon.Tile} tile - The tile which has been unloaded. - * @property {number} time - The current time in milliseconds when the tile load began. + * @property {OpenSeadragon.Tile} tile - The tile that failed to load. + * @property {number} time - The time in milliseconds when the tile load began. * @property {string} message - The error message. */ - tiledImage.viewer.raiseEvent("tile-open-failed", {tile: tile, tiledImage: tiledImage, time: time, message: errorMsg}); + tiledImage.viewer.raiseEvent("tile-load-failed", {tile: tile, tiledImage: tiledImage, time: time, message: errorMsg}); if( !tiledImage.debugMode ){ tile.loading = false; tile.exists = false;