mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
clean up comments and small fixes
This commit is contained in:
parent
3f7e7141b9
commit
074b65bfcd
@ -1417,7 +1417,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Update all tiles that contribute to the current view
|
* Update all tiles that contribute to the current view
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1475,7 +1474,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Updates the opacity of a tile according to the time it has been on screen
|
* Updates the opacity of a tile according to the time it has been on screen
|
||||||
* to perform a fade-in.
|
* to perform a fade-in.
|
||||||
* Updates coverage once a tile is fully opaque.
|
* Updates coverage once a tile is fully opaque.
|
||||||
@ -1640,7 +1638,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* @param {OpenSeadragon.Tile} tile
|
* @param {OpenSeadragon.Tile} tile
|
||||||
* @param {Boolean} overlap
|
* @param {Boolean} overlap
|
||||||
* @param {OpenSeadragon.Viewport} viewport
|
* @param {OpenSeadragon.Viewport} viewport
|
||||||
@ -1694,7 +1691,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Update a single tile at a particular resolution level.
|
* Update a single tile at a particular resolution level.
|
||||||
* @param {Boolean} haveDrawn
|
* @param {Boolean} haveDrawn
|
||||||
* @param {Boolean} drawLevel
|
* @param {Boolean} drawLevel
|
||||||
@ -1842,24 +1838,19 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Obtains a tile at the given location.
|
* Obtains a tile at the given location.
|
||||||
* @param {Number} x
|
* @param {Number} x
|
||||||
* @param {Number} y
|
* @param {Number} y
|
||||||
* @param {Number} level
|
* @param {Number} level
|
||||||
* @param {Number} time
|
* @param {Number} time
|
||||||
* @param {Number} numTiles
|
* @param {Number} numTiles
|
||||||
* @param {Number} worldWidth
|
|
||||||
* @param {Number} worldHeight
|
|
||||||
* @returns {OpenSeadragon.Tile}
|
* @returns {OpenSeadragon.Tile}
|
||||||
*/
|
*/
|
||||||
_getTile: function(
|
_getTile: function(
|
||||||
x, y,
|
x, y,
|
||||||
level,
|
level,
|
||||||
time,
|
time,
|
||||||
numTiles,
|
numTiles
|
||||||
worldWidth,
|
|
||||||
worldHeight
|
|
||||||
) {
|
) {
|
||||||
var xMod,
|
var xMod,
|
||||||
yMod,
|
yMod,
|
||||||
@ -1946,7 +1937,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Dispatch a job to the ImageLoader to load the Image for a Tile.
|
* Dispatch a job to the ImageLoader to load the Image for a Tile.
|
||||||
* @param {OpenSeadragon.Tile} tile
|
* @param {OpenSeadragon.Tile} tile
|
||||||
* @param {Number} time
|
* @param {Number} time
|
||||||
@ -1974,7 +1964,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Callback fired when a Tile's Image finished downloading.
|
* Callback fired when a Tile's Image finished downloading.
|
||||||
* @param {OpenSeadragon.Tile} tile
|
* @param {OpenSeadragon.Tile} tile
|
||||||
* @param {Number} time
|
* @param {Number} time
|
||||||
@ -2030,7 +2019,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* @param {OpenSeadragon.Tile} tile
|
* @param {OpenSeadragon.Tile} tile
|
||||||
* @param {*} data image data, the data sent to ImageJob.prototype.finish(), by default an Image object
|
* @param {*} data image data, the data sent to ImageJob.prototype.finish(), by default an Image object
|
||||||
* @param {Number|undefined} cutoff
|
* @param {Number|undefined} cutoff
|
||||||
@ -2124,7 +2112,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Determines the 'best tiles' from the given 'last best' tiles and the
|
* Determines the 'best tiles' from the given 'last best' tiles and the
|
||||||
* tile in question.
|
* tile in question.
|
||||||
*
|
*
|
||||||
@ -2147,7 +2134,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Sorts tiles in an array according to distance and visibility.
|
* Sorts tiles in an array according to distance and visibility.
|
||||||
*
|
*
|
||||||
* @param {OpenSeadragon.Tile[]} tiles The tiles.
|
* @param {OpenSeadragon.Tile[]} tiles The tiles.
|
||||||
@ -2171,7 +2157,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Returns true if the given tile provides coverage to lower-level tiles of
|
* 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
|
* lower resolution representing the same content. If neither x nor y is
|
||||||
* given, returns true if the entire visible level provides coverage.
|
* given, returns true if the entire visible level provides coverage.
|
||||||
@ -2220,7 +2205,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Returns true if the given tile is completely covered by higher-level
|
* Returns true if the given tile is completely covered by higher-level
|
||||||
* tiles of higher resolution representing the same content. If neither x
|
* tiles of higher resolution representing the same content. If neither x
|
||||||
* nor y is given, returns true if the entire visible level is covered.
|
* 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
|
* @private
|
||||||
* @inner
|
|
||||||
* Sets whether the given tile provides coverage or not.
|
* Sets whether the given tile provides coverage or not.
|
||||||
*
|
*
|
||||||
* @param {Object} coverage - A '3d' dictionary [level][x][y] --> Boolean.
|
* @param {Object} coverage - A '3d' dictionary [level][x][y] --> Boolean.
|
||||||
@ -2273,7 +2256,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
|
||||||
* Resets coverage information for the given level. This should be called
|
* Resets coverage information for the given level. This should be called
|
||||||
* after every draw routine. Note that at the beginning of the next draw
|
* after every draw routine. Note that at the beginning of the next draw
|
||||||
* routine, coverage for every visible tile should be explicitly set.
|
* routine, coverage for every visible tile should be explicitly set.
|
||||||
|
@ -83,8 +83,8 @@
|
|||||||
|
|
||||||
// Public API required by all Drawer implementations
|
// Public API required by all Drawer implementations
|
||||||
/**
|
/**
|
||||||
* Clean up the renderer, removing all resources
|
* Clean up the renderer, removing all resources
|
||||||
*/
|
*/
|
||||||
destroy(){
|
destroy(){
|
||||||
if(this.destroyed){
|
if(this.destroyed){
|
||||||
return;
|
return;
|
||||||
@ -135,9 +135,9 @@
|
|||||||
|
|
||||||
// Public API required by all Drawer implementations
|
// Public API required by all Drawer implementations
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns {Boolean} true if the drawer supports rotation
|
* @returns {Boolean} true if the drawer supports rotation
|
||||||
*/
|
*/
|
||||||
canRotate(){
|
canRotate(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -163,9 +163,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create the HTML element (canvas in this case) that the image will be drawn into
|
* create the HTML element (canvas in this case) that the image will be drawn into
|
||||||
* @returns {Element} the canvas to draw into
|
* @private
|
||||||
*/
|
* @returns {Element} the canvas to draw into
|
||||||
|
*/
|
||||||
_createDrawingElement(){
|
_createDrawingElement(){
|
||||||
let canvas = $.makeNeutralElement("canvas");
|
let canvas = $.makeNeutralElement("canvas");
|
||||||
let viewportSize = this._calculateCanvasSize();
|
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){
|
draw(tiledImages){
|
||||||
let gl = this._gl;
|
let gl = this._gl;
|
||||||
let viewport = {
|
let viewport = {
|
||||||
@ -356,7 +357,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fire tiled-image-drawn event.
|
// 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 ){
|
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. Only valid
|
||||||
@ -496,6 +498,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_setupRenderer(){
|
_setupRenderer(){
|
||||||
let gl = this._gl;
|
let gl = this._gl;
|
||||||
if(!gl){
|
if(!gl){
|
||||||
@ -531,6 +534,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//private
|
||||||
_makeFirstPassShaderProgram(){
|
_makeFirstPassShaderProgram(){
|
||||||
let numTextures = this._glNumTextures = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
|
let numTextures = this._glNumTextures = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
|
||||||
let makeMatrixUniforms = () => {
|
let makeMatrixUniforms = () => {
|
||||||
@ -627,6 +631,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_makeSecondPassShaderProgram(){
|
_makeSecondPassShaderProgram(){
|
||||||
const vertexShaderProgram = `
|
const vertexShaderProgram = `
|
||||||
attribute vec2 a_output_position;
|
attribute vec2 a_output_position;
|
||||||
@ -694,6 +699,7 @@
|
|||||||
gl.uniformMatrix3fv(this._secondPass.uMatrix, false, matrix.values);
|
gl.uniformMatrix3fv(this._secondPass.uMatrix, false, matrix.values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_resizeRenderer(){
|
_resizeRenderer(){
|
||||||
let gl = this._gl;
|
let gl = this._gl;
|
||||||
let w = this._renderingCanvas.width;
|
let w = this._renderingCanvas.width;
|
||||||
@ -717,6 +723,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_setupCanvases(){
|
_setupCanvases(){
|
||||||
let _this = this;
|
let _this = this;
|
||||||
|
|
||||||
@ -757,6 +764,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_makeQuadVertexBuffer(left, right, top, bottom){
|
_makeQuadVertexBuffer(left, right, top, bottom){
|
||||||
return new Float32Array([
|
return new Float32Array([
|
||||||
left, bottom,
|
left, bottom,
|
||||||
@ -767,7 +775,7 @@
|
|||||||
right, top]);
|
right, top]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_tileReadyHandler(event){
|
_tileReadyHandler(event){
|
||||||
let tile = event.tile;
|
let tile = event.tile;
|
||||||
let tiledImage = event.tiledImage;
|
let tiledImage = event.tiledImage;
|
||||||
@ -820,6 +828,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_calculateOverlapFraction(tile, tiledImage){
|
_calculateOverlapFraction(tile, tiledImage){
|
||||||
let overlap = tiledImage.source.tileOverlap;
|
let overlap = tiledImage.source.tileOverlap;
|
||||||
let nativeWidth = tile.sourceBounds.width; // in pixels
|
let nativeWidth = tile.sourceBounds.width; // in pixels
|
||||||
@ -834,6 +843,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_uploadImageData(tileContext){
|
_uploadImageData(tileContext){
|
||||||
|
|
||||||
let gl = this._gl;
|
let gl = this._gl;
|
||||||
@ -851,11 +861,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_imageUnloadedHandler(event){
|
_imageUnloadedHandler(event){
|
||||||
let canvas = event.context2D.canvas;
|
let canvas = event.context2D.canvas;
|
||||||
this._cleanupImageData(canvas);
|
this._cleanupImageData(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_cleanupImageData(tileCanvas){
|
_cleanupImageData(tileCanvas){
|
||||||
let textureInfo = this._TextureMap.get(tileCanvas);
|
let textureInfo = this._TextureMap.get(tileCanvas);
|
||||||
//remove from the map
|
//remove from the map
|
||||||
@ -867,6 +879,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private
|
// private
|
||||||
// necessary for clip testing to pass (test uses spyOnce(drawer._setClip))
|
// necessary for clip testing to pass (test uses spyOnce(drawer._setClip))
|
||||||
_setClip(rect){
|
_setClip(rect){
|
||||||
@ -874,6 +887,8 @@
|
|||||||
this._clippingContext.rect(rect.x, rect.y, rect.width, rect.height);
|
this._clippingContext.rect(rect.x, rect.y, rect.width, rect.height);
|
||||||
this._clippingContext.clip();
|
this._clippingContext.clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private
|
||||||
_renderToClippingCanvas(item){
|
_renderToClippingCanvas(item){
|
||||||
|
|
||||||
this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height);
|
this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height);
|
||||||
|
Loading…
Reference in New Issue
Block a user