From a12b74ec17d42d90c5528f1f8070345a6b6c7cc7 Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Sun, 24 Jan 2016 16:09:18 -0500 Subject: [PATCH] Fix @lends for new JSDoc. Fix polymorphic functions doc (#824). --- src/buttongroup.js | 3 ++- src/control.js | 3 ++- src/controldock.js | 3 ++- src/drawer.js | 3 ++- src/eventsource.js | 3 ++- src/imageloader.js | 3 ++- src/mousetracker.js | 7 +++++-- src/overlay.js | 3 ++- src/point.js | 3 ++- src/profiler.js | 3 ++- src/rectangle.js | 5 +++-- src/spring.js | 3 ++- src/tile.js | 3 ++- src/tilecache.js | 3 ++- src/tilesource.js | 4 ++-- src/viewport.js | 50 ++++++++++++++++++++++----------------------- 16 files changed, 59 insertions(+), 43 deletions(-) diff --git a/src/buttongroup.js b/src/buttongroup.js index 77d61371..daee211c 100644 --- a/src/buttongroup.js +++ b/src/buttongroup.js @@ -108,7 +108,8 @@ $.ButtonGroup = function( options ) { }); }; -$.ButtonGroup.prototype = /** @lends OpenSeadragon.ButtonGroup.prototype */{ +/** @lends OpenSeadragon.ButtonGroup.prototype */ +$.ButtonGroup.prototype = { /** * TODO: Figure out why this is used on the public API and if a more useful diff --git a/src/control.js b/src/control.js index f563ac58..c1ba2186 100644 --- a/src/control.js +++ b/src/control.js @@ -152,7 +152,8 @@ $.Control = function ( element, options, container ) { } }; -$.Control.prototype = /** @lends OpenSeadragon.Control.prototype */{ +/** @lends OpenSeadragon.Control.prototype */ +$.Control.prototype = { /** * Removes the control from the container. diff --git a/src/controldock.js b/src/controldock.js index e7753743..2ee2d0f1 100644 --- a/src/controldock.js +++ b/src/controldock.js @@ -88,7 +88,8 @@ this.container.appendChild( this.controls.bottomleft ); }; - $.ControlDock.prototype = /** @lends OpenSeadragon.ControlDock.prototype */{ + /** @lends OpenSeadragon.ControlDock.prototype */ + $.ControlDock.prototype = { /** * @function diff --git a/src/drawer.js b/src/drawer.js index f4ed36a6..05f45803 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -132,7 +132,8 @@ $.Drawer = function( options ) { this.container.appendChild( this.canvas ); }; -$.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{ +/** @lends OpenSeadragon.Drawer.prototype */ +$.Drawer.prototype = { // deprecated addOverlay: function( element, location, placement, onDraw ) { $.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."); diff --git a/src/eventsource.js b/src/eventsource.js index a9578ef0..e305da25 100644 --- a/src/eventsource.js +++ b/src/eventsource.js @@ -53,7 +53,8 @@ $.EventSource = function() { this.events = {}; }; -$.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{ +/** @lends OpenSeadragon.EventSource.prototype */ +$.EventSource.prototype = { // TODO: Add a method 'one' which automatically unbinds a listener after the first triggered event that matches. diff --git a/src/imageloader.js b/src/imageloader.js index ef3a4f4f..cd654722 100644 --- a/src/imageloader.js +++ b/src/imageloader.js @@ -110,7 +110,8 @@ $.ImageLoader = function( options ) { }; -$.ImageLoader.prototype = /** @lends OpenSeadragon.ImageLoader.prototype */{ +/** @lends OpenSeadragon.ImageLoader.prototype */ +$.ImageLoader.prototype = { /** * Add an unloaded image to the loader queue. diff --git a/src/mousetracker.js b/src/mousetracker.js index a57993de..4528df03 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -265,7 +265,8 @@ } }; - $.MouseTracker.prototype = /** @lends OpenSeadragon.MouseTracker.prototype */{ + /** @lends OpenSeadragon.MouseTracker.prototype */ + $.MouseTracker.prototype = { /** * Clean up any events or objects created by the tracker. @@ -1117,7 +1118,9 @@ */ this.captureCount = 0; }; - $.MouseTracker.GesturePointList.prototype = /** @lends OpenSeadragon.MouseTracker.GesturePointList.prototype */{ + + /** @lends OpenSeadragon.MouseTracker.GesturePointList.prototype */ + $.MouseTracker.GesturePointList.prototype = { /** * @function * @returns {Number} Number of gesture points in the list. diff --git a/src/overlay.js b/src/overlay.js index 2fe72413..41f8b9be 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -133,7 +133,8 @@ true : options.checkResize; }; - $.Overlay.prototype = /** @lends OpenSeadragon.Overlay.prototype */{ + /** @lends OpenSeadragon.Overlay.prototype */ + $.Overlay.prototype = { /** * @function diff --git a/src/point.js b/src/point.js index ebddfffe..7d4f6740 100644 --- a/src/point.js +++ b/src/point.js @@ -59,7 +59,8 @@ $.Point = function( x, y ) { this.y = typeof ( y ) == "number" ? y : 0; }; -$.Point.prototype = /** @lends OpenSeadragon.Point.prototype */{ +/** @lends OpenSeadragon.Point.prototype */ +$.Point.prototype = { /** * @function * @returns {OpenSeadragon.Point} a duplicate of this Point diff --git a/src/profiler.js b/src/profiler.js index 5e6cfb7c..3f9d708f 100644 --- a/src/profiler.js +++ b/src/profiler.js @@ -68,7 +68,8 @@ $.Profiler = function() { this.maxIdleTime = 0; }; -$.Profiler.prototype = /** @lends OpenSeadragon.Profiler.prototype */{ +/** @lends OpenSeadragon.Profiler.prototype */ +$.Profiler.prototype = { /** * @function diff --git a/src/rectangle.js b/src/rectangle.js index 2cfd4060..cae13e88 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -110,7 +110,8 @@ $.Rect = function(x, y, width, height, degrees) { } }; -$.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{ +/** @lends OpenSeadragon.Rect.prototype */ +$.Rect.prototype = { /** * @function * @returns {OpenSeadragon.Rect} a duplicate of this Rect @@ -318,7 +319,7 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{ /** * Retrieves the smallest horizontal (degrees=0) rectangle which contains * this rectangle. - * @returns {OpenSeadrayon.Rect} + * @returns {OpenSeadragon.Rect} */ getBoundingBox: function() { if (this.degrees === 0) { diff --git a/src/spring.js b/src/spring.js index 178bab10..e580b2e6 100644 --- a/src/spring.js +++ b/src/spring.js @@ -134,7 +134,8 @@ $.Spring = function( options ) { } }; -$.Spring.prototype = /** @lends OpenSeadragon.Spring.prototype */{ +/** @lends OpenSeadragon.Spring.prototype */ +$.Spring.prototype = { /** * @function diff --git a/src/tile.js b/src/tile.js index a07bec74..30eac238 100644 --- a/src/tile.js +++ b/src/tile.js @@ -180,7 +180,8 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) { this.lastTouchTime = 0; }; -$.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{ +/** @lends OpenSeadragon.Tile.prototype */ +$.Tile.prototype = { /** * Provides a string representation of this tiles level and (x,y) diff --git a/src/tilecache.js b/src/tilecache.js index 281709c8..ee3a4662 100644 --- a/src/tilecache.js +++ b/src/tilecache.js @@ -122,7 +122,8 @@ $.TileCache = function( options ) { this._imagesLoadedCount = 0; }; -$.TileCache.prototype = /** @lends OpenSeadragon.TileCache.prototype */{ +/** @lends OpenSeadragon.TileCache.prototype */ +$.TileCache.prototype = { /** * @returns {Number} The total number of tiles that have been loaded by * this TileCache. diff --git a/src/tilesource.js b/src/tilesource.js index b13df91d..290a5758 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -230,8 +230,8 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve }; - -$.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{ +/** @lends OpenSeadragon.TileSource.prototype */ +$.TileSource.prototype = { getTileSize: function( level ) { $.console.error( diff --git a/src/viewport.js b/src/viewport.js index 63493371..a9b12eb7 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -144,7 +144,8 @@ $.Viewport = function( options ) { this.update(); }; -$.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ +/** @lends OpenSeadragon.Viewport.prototype */ +$.Viewport.prototype = { /** * Updates the viewport's home bounds and constraints for the given content size. * @function @@ -1076,15 +1077,15 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ * OpenSeadragon.Point * Note: not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead. * @function - * @param {OpenSeadragon.Point} viewerX the point in viewport coordinate system. - * @param {Number} viewerX X coordinate in viewport coordinate system. - * @param {Number} viewerY Y coordinate in viewport coordinate system. + * @param {(OpenSeadragon.Point|Number)} viewerX either a point or the X + * coordinate in viewport coordinate system. + * @param {Number} [viewerY] Y coordinate in viewport coordinate system. * @return {OpenSeadragon.Point} a point representing the coordinates in the image. */ - viewportToImageCoordinates: function( viewerX, viewerY ) { - if ( arguments.length == 1 ) { + viewportToImageCoordinates: function(viewerX, viewerY) { + if (viewerX instanceof $.Point) { //they passed a point instead of individual components - return this.viewportToImageCoordinates( viewerX.x, viewerX.y ); + return this.viewportToImageCoordinates(viewerX.x, viewerX.y); } if (this.viewer && this.viewer.world.getItemCount() > 1) { @@ -1107,15 +1108,15 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ * OpenSeadragon.Point * Note: not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead. * @function - * @param {OpenSeadragon.Point} imageX the point in image coordinate system. - * @param {Number} imageX X coordinate in image coordinate system. - * @param {Number} imageY Y coordinate in image coordinate system. + * @param {(OpenSeadragon.Point | Number)} imageX the point or the + * X coordinate in image coordinate system. + * @param {Number} [imageY] Y coordinate in image coordinate system. * @return {OpenSeadragon.Point} a point representing the coordinates in the viewport. */ - imageToViewportCoordinates: function( imageX, imageY ) { - if ( arguments.length == 1 ) { + imageToViewportCoordinates: function(imageX, imageY) { + if (imageX instanceof $.Point) { //they passed a point instead of individual components - return this.imageToViewportCoordinates( imageX.x, imageX.y ); + return this.imageToViewportCoordinates(imageX.x, imageX.y); } if (this.viewer && this.viewer.world.getItemCount() > 1) { @@ -1135,13 +1136,12 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ * OpenSeadragon.Rect * Note: not accurate with multi-image; use TiledImage.imageToViewportRectangle instead. * @function - * @param {OpenSeadragon.Rect} imageX the rectangle in image coordinate system. - * @param {Number} imageX the X coordinate of the top left corner of the rectangle + * @param {(OpenSeadragon.Rect | Number)} imageX the rectangle or the X + * coordinate of the top left corner of the rectangle in image coordinate system. + * @param {Number} [imageY] the Y coordinate of the top left corner of the rectangle * in image coordinate system. - * @param {Number} imageY the Y coordinate of the top left corner of the rectangle - * in image coordinate system. - * @param {Number} pixelWidth the width in pixel of the rectangle. - * @param {Number} pixelHeight the height in pixel of the rectangle. + * @param {Number} [pixelWidth] the width in pixel of the rectangle. + * @param {Number} [pixelHeight] the height in pixel of the rectangle. */ imageToViewportRectangle: function(imageX, imageY, pixelWidth, pixelHeight) { var rect = imageX; @@ -1168,13 +1168,13 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ * OpenSeadragon.Rect * Note: not accurate with multi-image; use TiledImage.viewportToImageRectangle instead. * @function - * @param {OpenSeadragon.Rect} viewerX the rectangle in viewport coordinate system. - * @param {Number} viewerX the X coordinate of the top left corner of the rectangle + * @param {(OpenSeadragon.Rect | Number)} viewerX either a rectangle or + * the X coordinate of the top left corner of the rectangle in viewport + * coordinate system. + * @param {Number} [viewerY] the Y coordinate of the top left corner of the rectangle * in viewport coordinate system. - * @param {Number} imageY the Y coordinate of the top left corner of the rectangle - * in viewport coordinate system. - * @param {Number} pointWidth the width of the rectangle in viewport coordinate system. - * @param {Number} pointHeight the height of the rectangle in viewport coordinate system. + * @param {Number} [pointWidth] the width of the rectangle in viewport coordinate system. + * @param {Number} [pointHeight] the height of the rectangle in viewport coordinate system. */ viewportToImageRectangle: function(viewerX, viewerY, pointWidth, pointHeight) { var rect = viewerX;