From 2336b8161876f9e1ca2ac4bbbb4bce953329354e Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 20 Nov 2014 16:41:43 -0800 Subject: [PATCH] TiledImage update events now include which tiled image --- src/tiledimage.js | 6 ++++++ test/modules/tiledimage.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/tiledimage.js b/src/tiledimage.js index dc4f6c29..40726dbd 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -438,6 +438,7 @@ function updateLevel( tiledImage, haveDrawn, drawLevel, level, levelOpacity, lev * @memberof OpenSeadragon.Viewer * @type {object} * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event. + * @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn. * @property {Object} havedrawn * @property {Object} level * @property {Object} opacity @@ -449,6 +450,7 @@ function updateLevel( tiledImage, haveDrawn, drawLevel, level, levelOpacity, lev * @property {?Object} userData - Arbitrary subscriber-defined object. */ tiledImage.viewer.raiseEvent( 'update-level', { + tiledImage: tiledImage, havedrawn: haveDrawn, level: level, opacity: levelOpacity, @@ -519,10 +521,12 @@ function updateTile( tiledImage, drawLevel, haveDrawn, x, y, level, levelOpacity * @memberof OpenSeadragon.Viewer * @type {object} * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event. + * @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn. * @property {OpenSeadragon.Tile} tile * @property {?Object} userData - Arbitrary subscriber-defined object. */ tiledImage.viewer.raiseEvent( 'update-tile', { + tiledImage: tiledImage, tile: tile }); } @@ -889,10 +893,12 @@ function drawTiles( tiledImage, lastDrawn ){ * @memberof OpenSeadragon.Viewer * @type {object} * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event. + * @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn. * @property {OpenSeadragon.Tile} tile * @property {?Object} userData - Arbitrary subscriber-defined object. */ tiledImage.viewer.raiseEvent( 'tile-drawn', { + tiledImage: tiledImage, tile: tile }); } diff --git a/test/modules/tiledimage.js b/test/modules/tiledimage.js index 72f9a728..186d6686 100644 --- a/test/modules/tiledimage.js +++ b/test/modules/tiledimage.js @@ -83,6 +83,7 @@ viewer.removeHandler('update-level', updateLevelHandler); handlerCount++; equal(event.eventSource, viewer, 'sender of update-level event was viewer'); + equal(event.tiledImage, image, 'tiledImage of update-level event is correct'); ok('havedrawn' in event, 'update-level event includes havedrawn'); ok('level' in event, 'update-level event includes level'); ok('opacity' in event, 'update-level event includes opacity'); @@ -97,6 +98,7 @@ viewer.removeHandler('update-tile', updateTileHandler); handlerCount++; equal(event.eventSource, viewer, 'sender of update-tile event was viewer'); + equal(event.tiledImage, image, 'tiledImage of update-level event is correct'); ok(event.tile, 'update-tile event includes tile'); }); @@ -104,6 +106,7 @@ viewer.removeHandler('tile-drawn', tileDrawnHandler); handlerCount++; equal(event.eventSource, viewer, 'sender of tile-drawn event was viewer'); + equal(event.tiledImage, image, 'tiledImage of update-level event is correct'); ok(event.tile, 'tile-drawn event includes tile'); equal(handlerCount, 3, 'correct number of handlers called');