update tiled-image-drawn event description

This commit is contained in:
Tom 2024-01-10 12:21:05 -05:00
parent 58f918aaa1
commit 9725ac0398
2 changed files with 23 additions and 61 deletions

View File

@ -101,24 +101,6 @@ class CanvasDrawer extends $.DrawerBase{
this._drawTiles(tiledImage); this._drawTiles(tiledImage);
} }
} }
// // Fire the frame-drawn event.
// if( this.viewer ){
// /**
// * Raised when a tiled image is drawn to the canvas. Only valid
// * for webgl and canvas drawers.
// *
// * @event tiled-image-drawn
// * @memberof OpenSeadragon.Viewer
// * @type {object}
// * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
// * @property {HTMLElement} canvas - The canvas which has been drawn onto
// * @property {?Object} userData - Arbitrary subscriber-defined object.
// */
// this.viewer.raiseEvent( 'frame-drawn', {
// canvas: this.canvas
// });
// }
} }
/** /**
@ -499,17 +481,17 @@ class CanvasDrawer extends $.DrawerBase{
// Fire tiled-image-drawn event. // Fire tiled-image-drawn event.
if( this.viewer ){ if( this.viewer ){
/** /**
* Raised when a tiled image is drawn to the canvas. Only valid * Raised when a tiled image is drawn to the canvas. Used internally for testing.
* for webgl and canvas drawers. * The update-viewport event is preferred if you want to know when a frame has been drawn.
* *
* @event tiled-image-drawn * @event tiled-image-drawn
* @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.TiledImage} tiledImage - Which TiledImage is being drawn.
* @property {Array} tiles - An array of Tile objects that were drawn. * @property {Array} tiles - An array of Tile objects that were drawn.
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
this.viewer.raiseEvent( 'tiled-image-drawn', { this.viewer.raiseEvent( 'tiled-image-drawn', {
tiledImage: tiledImage, tiledImage: tiledImage,
tiles: lastDrawn, tiles: lastDrawn,

View File

@ -352,22 +352,20 @@
gl.clear(gl.COLOR_BUFFER_BIT); // clear the back buffer gl.clear(gl.COLOR_BUFFER_BIT); // clear the back buffer
} }
// Fire tiled-image-drawn event. // Fire tiled-image-drawn event. This is used for the tests
// TODO: for discussion: do we need to ensure the image has been drawn to the output canvas already?
// Is it possible the image data may not be on the output canvas? Does it matter?
if( this.viewer ){ if( this.viewer ){
/** /**
* Raised when a tiled image is drawn to the canvas. Only valid * Raised when a tiled image is drawn to the canvas. Used internally for testing.
* for webgl and canvas drawers. * The update-viewport event is preferred if you want to know when a frame has been drawn.
* *
* @event tiled-image-drawn * @event tiled-image-drawn
* @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.TiledImage} tiledImage - Which TiledImage is being drawn.
* @property {Array} tiles - An array of Tile objects that were drawn. * @property {Array} tiles - An array of Tile objects that were drawn.
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
this.viewer.raiseEvent( 'tiled-image-drawn', { this.viewer.raiseEvent( 'tiled-image-drawn', {
tiledImage: tiledImage, tiledImage: tiledImage,
tiles: tilesToDraw.map(info => info.tile), tiles: tilesToDraw.map(info => info.tile),
@ -380,24 +378,6 @@
this._outputContext.drawImage(this._renderingCanvas, 0, 0); this._outputContext.drawImage(this._renderingCanvas, 0, 0);
} }
// // Fire the frame-drawn event.
// if( this.viewer ){
// /**
// * Raised when a tiled image is drawn to the canvas. Only valid
// * for webgl and canvas drawers.
// *
// * @event tiled-image-drawn
// * @memberof OpenSeadragon.Viewer
// * @type {object}
// * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
// * @property {HTMLElement} canvas - The canvas which has been drawn onto
// * @property {?Object} userData - Arbitrary subscriber-defined object.
// */
// this.viewer.raiseEvent( 'frame-drawn', {
// canvas: this.canvas
// });
// }
} }
// Public API required by all Drawer implementations // Public API required by all Drawer implementations