clean up comments and small fixes

This commit is contained in:
Tom 2023-12-14 20:59:55 -05:00
parent 3f7e7141b9
commit 074b65bfcd
2 changed files with 29 additions and 32 deletions

View File

@ -1417,7 +1417,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Update all tiles that contribute to the current view
*
*/
@ -1475,7 +1474,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Updates the opacity of a tile according to the time it has been on screen
* to perform a fade-in.
* Updates coverage once a tile is fully opaque.
@ -1640,7 +1638,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* @param {OpenSeadragon.Tile} tile
* @param {Boolean} overlap
* @param {OpenSeadragon.Viewport} viewport
@ -1694,7 +1691,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Update a single tile at a particular resolution level.
* @param {Boolean} haveDrawn
* @param {Boolean} drawLevel
@ -1842,24 +1838,19 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Obtains a tile at the given location.
* @param {Number} x
* @param {Number} y
* @param {Number} level
* @param {Number} time
* @param {Number} numTiles
* @param {Number} worldWidth
* @param {Number} worldHeight
* @returns {OpenSeadragon.Tile}
*/
_getTile: function(
x, y,
level,
time,
numTiles,
worldWidth,
worldHeight
numTiles
) {
var xMod,
yMod,
@ -1946,7 +1937,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Dispatch a job to the ImageLoader to load the Image for a Tile.
* @param {OpenSeadragon.Tile} tile
* @param {Number} time
@ -1974,7 +1964,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Callback fired when a Tile's Image finished downloading.
* @param {OpenSeadragon.Tile} tile
* @param {Number} time
@ -2030,7 +2019,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* @param {OpenSeadragon.Tile} tile
* @param {*} data image data, the data sent to ImageJob.prototype.finish(), by default an Image object
* @param {Number|undefined} cutoff
@ -2124,7 +2112,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Determines the 'best tiles' from the given 'last best' tiles and the
* tile in question.
*
@ -2147,7 +2134,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Sorts tiles in an array according to distance and visibility.
*
* @param {OpenSeadragon.Tile[]} tiles The tiles.
@ -2171,7 +2157,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Returns true if the given tile provides coverage to lower-level tiles of
* lower resolution representing the same content. If neither x nor y is
* given, returns true if the entire visible level provides coverage.
@ -2220,7 +2205,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Returns true if the given tile is completely covered by higher-level
* tiles of higher resolution representing the same content. If neither x
* nor y is given, returns true if the entire visible level is covered.
@ -2246,7 +2230,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Sets whether the given tile provides coverage or not.
*
* @param {Object} coverage - A '3d' dictionary [level][x][y] --> Boolean.
@ -2273,7 +2256,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/**
* @private
* @inner
* Resets coverage information for the given level. This should be called
* after every draw routine. Note that at the beginning of the next draw
* routine, coverage for every visible tile should be explicitly set.

View File

@ -83,8 +83,8 @@
// Public API required by all Drawer implementations
/**
* Clean up the renderer, removing all resources
*/
* Clean up the renderer, removing all resources
*/
destroy(){
if(this.destroyed){
return;
@ -135,9 +135,9 @@
// Public API required by all Drawer implementations
/**
*
* @returns {Boolean} true if the drawer supports rotation
*/
*
* @returns {Boolean} true if the drawer supports rotation
*/
canRotate(){
return true;
}
@ -163,9 +163,10 @@
}
/**
* create the HTML element (canvas in this case) that the image will be drawn into
* @returns {Element} the canvas to draw into
*/
* create the HTML element (canvas in this case) that the image will be drawn into
* @private
* @returns {Element} the canvas to draw into
*/
_createDrawingElement(){
let canvas = $.makeNeutralElement("canvas");
let viewportSize = this._calculateCanvasSize();
@ -175,9 +176,9 @@
}
/**
*
* @param {Array} tiledImages Array of TiledImage objects to draw
*/
*
* @param {Array} tiledImages Array of TiledImage objects to draw
*/
draw(tiledImages){
let gl = this._gl;
let viewport = {
@ -356,7 +357,8 @@
}
// Fire tiled-image-drawn event.
// TODO: 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?
// 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 ){
/**
* Raised when a tiled image is drawn to the canvas. Only valid
@ -496,6 +498,7 @@
}
// private
_setupRenderer(){
let gl = this._gl;
if(!gl){
@ -531,6 +534,7 @@
}
//private
_makeFirstPassShaderProgram(){
let numTextures = this._glNumTextures = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
let makeMatrixUniforms = () => {
@ -627,6 +631,7 @@
}
// private
_makeSecondPassShaderProgram(){
const vertexShaderProgram = `
attribute vec2 a_output_position;
@ -694,6 +699,7 @@
gl.uniformMatrix3fv(this._secondPass.uMatrix, false, matrix.values);
}
// private
_resizeRenderer(){
let gl = this._gl;
let w = this._renderingCanvas.width;
@ -717,6 +723,7 @@
}
// private
_setupCanvases(){
let _this = this;
@ -757,6 +764,7 @@
});
}
// private
_makeQuadVertexBuffer(left, right, top, bottom){
return new Float32Array([
left, bottom,
@ -767,7 +775,7 @@
right, top]);
}
// private
_tileReadyHandler(event){
let tile = event.tile;
let tiledImage = event.tiledImage;
@ -820,6 +828,7 @@
}
// private
_calculateOverlapFraction(tile, tiledImage){
let overlap = tiledImage.source.tileOverlap;
let nativeWidth = tile.sourceBounds.width; // in pixels
@ -834,6 +843,7 @@
};
}
// private
_uploadImageData(tileContext){
let gl = this._gl;
@ -851,11 +861,13 @@
}
}
// private
_imageUnloadedHandler(event){
let canvas = event.context2D.canvas;
this._cleanupImageData(canvas);
}
// private
_cleanupImageData(tileCanvas){
let textureInfo = this._TextureMap.get(tileCanvas);
//remove from the map
@ -867,6 +879,7 @@
}
}
// private
// necessary for clip testing to pass (test uses spyOnce(drawer._setClip))
_setClip(rect){
@ -874,6 +887,8 @@
this._clippingContext.rect(rect.x, rect.y, rect.width, rect.height);
this._clippingContext.clip();
}
// private
_renderToClippingCanvas(item){
this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height);