TiledImage update events now include which tiled image

This commit is contained in:
Ian Gilman 2014-11-20 16:41:43 -08:00
parent 36831d3434
commit 2336b81618
2 changed files with 9 additions and 0 deletions

View File

@ -438,6 +438,7 @@ function updateLevel( tiledImage, haveDrawn, drawLevel, level, levelOpacity, lev
* @memberof OpenSeadragon.Viewer * @memberof OpenSeadragon.Viewer
* @type {object} * @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event. * @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} havedrawn
* @property {Object} level * @property {Object} level
* @property {Object} opacity * @property {Object} opacity
@ -449,6 +450,7 @@ function updateLevel( tiledImage, haveDrawn, drawLevel, level, levelOpacity, lev
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
tiledImage.viewer.raiseEvent( 'update-level', { tiledImage.viewer.raiseEvent( 'update-level', {
tiledImage: tiledImage,
havedrawn: haveDrawn, havedrawn: haveDrawn,
level: level, level: level,
opacity: levelOpacity, opacity: levelOpacity,
@ -519,10 +521,12 @@ function updateTile( tiledImage, drawLevel, haveDrawn, x, y, level, levelOpacity
* @memberof OpenSeadragon.Viewer * @memberof OpenSeadragon.Viewer
* @type {object} * @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event. * @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 {OpenSeadragon.Tile} tile
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
tiledImage.viewer.raiseEvent( 'update-tile', { tiledImage.viewer.raiseEvent( 'update-tile', {
tiledImage: tiledImage,
tile: tile tile: tile
}); });
} }
@ -889,10 +893,12 @@ function drawTiles( tiledImage, lastDrawn ){
* @memberof OpenSeadragon.Viewer * @memberof OpenSeadragon.Viewer
* @type {object} * @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event. * @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 {OpenSeadragon.Tile} tile
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
tiledImage.viewer.raiseEvent( 'tile-drawn', { tiledImage.viewer.raiseEvent( 'tile-drawn', {
tiledImage: tiledImage,
tile: tile tile: tile
}); });
} }

View File

@ -83,6 +83,7 @@
viewer.removeHandler('update-level', updateLevelHandler); viewer.removeHandler('update-level', updateLevelHandler);
handlerCount++; handlerCount++;
equal(event.eventSource, viewer, 'sender of update-level event was viewer'); 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('havedrawn' in event, 'update-level event includes havedrawn');
ok('level' in event, 'update-level event includes level'); ok('level' in event, 'update-level event includes level');
ok('opacity' in event, 'update-level event includes opacity'); ok('opacity' in event, 'update-level event includes opacity');
@ -97,6 +98,7 @@
viewer.removeHandler('update-tile', updateTileHandler); viewer.removeHandler('update-tile', updateTileHandler);
handlerCount++; handlerCount++;
equal(event.eventSource, viewer, 'sender of update-tile event was viewer'); 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'); ok(event.tile, 'update-tile event includes tile');
}); });
@ -104,6 +106,7 @@
viewer.removeHandler('tile-drawn', tileDrawnHandler); viewer.removeHandler('tile-drawn', tileDrawnHandler);
handlerCount++; handlerCount++;
equal(event.eventSource, viewer, 'sender of tile-drawn event was viewer'); 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'); ok(event.tile, 'tile-drawn event includes tile');
equal(handlerCount, 3, 'correct number of handlers called'); equal(handlerCount, 3, 'correct number of handlers called');