From 5baa8d3252a1a9bfee7bfec9daaf3ddfc03b430b Mon Sep 17 00:00:00 2001 From: Shyamkumar Yadav <46707211+shyamkumaryadav@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:12:18 +0530 Subject: [PATCH 01/12] docs: change `@return` -> `@returns` --- src/control.js | 2 +- src/controldock.js | 8 ++++---- src/drawer.js | 7 ++++--- src/dzitilesource.js | 2 +- src/eventsource.js | 2 +- src/iiiftilesource.js | 2 +- src/imagetilesource.js | 2 +- src/legacytilesource.js | 2 +- src/openseadragon.js | 6 +++--- src/osmtilesource.js | 2 +- src/rectangle.js | 8 ++++---- src/tile.js | 10 ++++----- src/tiledimage.js | 8 ++++---- src/tilesource.js | 14 ++++++------- src/tmstilesource.js | 2 +- src/viewer.js | 44 ++++++++++++++++++++-------------------- src/viewport.js | 44 ++++++++++++++++++++-------------------- src/zoomifytilesource.js | 2 +- 18 files changed, 84 insertions(+), 83 deletions(-) diff --git a/src/control.js b/src/control.js index 43abf65c..78e73cf7 100644 --- a/src/control.js +++ b/src/control.js @@ -169,7 +169,7 @@ $.Control.prototype = { /** * Determines if the control is currently visible. * @function - * @return {Boolean} true if currently visible, false otherwise. + * @returns {Boolean} true if currently visible, false otherwise. */ isVisible: function() { return this.wrapper.style.display !== "none"; diff --git a/src/controldock.js b/src/controldock.js index 129d43e2..16078833 100644 --- a/src/controldock.js +++ b/src/controldock.js @@ -149,7 +149,7 @@ /** * @function - * @return {OpenSeadragon.ControlDock} Chainable. + * @returns {OpenSeadragon.ControlDock} Chainable. */ removeControl: function ( element ) { element = $.getElement( element ); @@ -165,7 +165,7 @@ /** * @function - * @return {OpenSeadragon.ControlDock} Chainable. + * @returns {OpenSeadragon.ControlDock} Chainable. */ clearControls: function () { while ( this.controls.length > 0 ) { @@ -178,7 +178,7 @@ /** * @function - * @return {Boolean} + * @returns {Boolean} */ areControlsEnabled: function () { var i; @@ -195,7 +195,7 @@ /** * @function - * @return {OpenSeadragon.ControlDock} Chainable. + * @returns {OpenSeadragon.ControlDock} Chainable. */ setControlsEnabled: function( enabled ) { var i; diff --git a/src/drawer.js b/src/drawer.js index c8175abd..9a3578f9 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -176,6 +176,7 @@ $.Drawer.prototype = { * This function does not take rotation into account, thus assuming provided * point is at 0 degree. * @param {OpenSeadragon.Point} point - the pixel point to convert + * @returns {OpenSeadragon.Point} Point in drawer coordinate system. */ viewportCoordToDrawerCoord: function(point) { var vpPoint = this.viewport.pixelFromPointNoRotate(point, true); @@ -208,7 +209,7 @@ $.Drawer.prototype = { /** * Set the opacity of the drawer. * @param {Number} opacity - * @return {OpenSeadragon.Drawer} Chainable. + * @returns {OpenSeadragon.Drawer} Chainable. */ setOpacity: function( opacity ) { $.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead."); @@ -264,7 +265,7 @@ $.Drawer.prototype = { }, /** - * @return {Boolean} True if rotation is supported. + * @returns {Boolean} True if rotation is supported. */ canRotate: function() { return this.useCanvas; @@ -321,7 +322,7 @@ $.Drawer.prototype = { * Scale from OpenSeadragon viewer rectangle to drawer rectangle * (ignoring rotation) * @param {OpenSeadragon.Rect} rectangle - The rectangle in viewport coordinate system. - * @return {OpenSeadragon.Rect} Rectangle in drawer coordinate system. + * @returns {OpenSeadragon.Rect} Rectangle in drawer coordinate system. */ viewportToDrawerRectangle: function(rectangle) { var topLeft = this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(), true); diff --git a/src/dzitilesource.js b/src/dzitilesource.js index 72cd1828..f19d11ab 100644 --- a/src/dzitilesource.js +++ b/src/dzitilesource.js @@ -125,7 +125,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead * @param {Object|XMLDocument} data - the raw configuration * @param {String} url - the url the data was retrieved from if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure this tile sources constructor. */ configure: function( data, url, postData ){ diff --git a/src/eventsource.js b/src/eventsource.js index 046f80bc..9bc29704 100644 --- a/src/eventsource.js +++ b/src/eventsource.js @@ -125,7 +125,7 @@ $.EventSource.prototype = { /** * Get the amount of handlers registered for a given event. * @param {String} eventName - Name of event to inspect. - * @return {number} amount of events + * @returns {number} amount of events */ numberOfHandlers: function (eventName) { var events = this.events[ eventName ]; diff --git a/src/iiiftilesource.js b/src/iiiftilesource.js index d1331cd3..564d7833 100644 --- a/src/iiiftilesource.js +++ b/src/iiiftilesource.js @@ -193,7 +193,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea * @param {Object} data - the raw configuration * @param {String} url - the url configuration was retrieved from * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} A normalized IIIF data object + * @returns {Object} A normalized IIIF data object * @example IIIF 2.x Info Looks like this * { * "@context": "http://iiif.io/api/image/2/context.json", diff --git a/src/imagetilesource.js b/src/imagetilesource.js index aea4849e..5ff3cce6 100644 --- a/src/imagetilesource.js +++ b/src/imagetilesource.js @@ -90,7 +90,7 @@ * @param {Object} options - the options * @param {String} dataUrl - the url the image was retrieved from, if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure this tile sources constructor. */ configure: function (options, dataUrl, postData) { diff --git a/src/legacytilesource.js b/src/legacytilesource.js index ea93009e..3b7d8f38 100644 --- a/src/legacytilesource.js +++ b/src/legacytilesource.js @@ -123,7 +123,7 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS * @param {Object|XMLDocument} configuration - the raw configuration * @param {String} dataUrl - the url the data was retrieved from if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure this tile sources constructor. */ configure: function( configuration, dataUrl, postData ){ diff --git a/src/openseadragon.js b/src/openseadragon.js index 685ef10f..90823428 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -922,7 +922,7 @@ function OpenSeadragon( options ){ /** * Shim around Object.freeze. Does nothing if Object.freeze is not supported. * @param {Object} obj The object to freeze. - * @return {Object} obj The frozen object. + * @returns {Object} obj The frozen object. */ $.freezeObject = function(obj) { if (Object.freeze) { @@ -2109,7 +2109,7 @@ function OpenSeadragon( options ){ * @param {Boolean} [options.capture] * @param {Boolean} [options.passive] * @param {Boolean} [options.once] - * @return {String} The protocol (http:, https:, file:, ftp: ...) + * @returns {String} The protocol (http:, https:, file:, ftp: ...) */ normalizeEventListenerOptions: function (options) { var opts; @@ -2273,7 +2273,7 @@ function OpenSeadragon( options ){ * @function * @private * @param {String} url The url to retrieve the protocol from. - * @return {String} The protocol (http:, https:, file:, ftp: ...) + * @returns {String} The protocol (http:, https:, file:, ftp: ...) */ getUrlProtocol: function( url ) { var match = url.match(/^([a-z]+:)\/\//i); diff --git a/src/osmtilesource.js b/src/osmtilesource.js index eeadaa5f..9cb7ef63 100644 --- a/src/osmtilesource.js +++ b/src/osmtilesource.js @@ -123,7 +123,7 @@ $.extend( $.OsmTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead * @param {Object} data - the raw configuration * @param {String} url - the url the data was retrieved from if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure this tile sources constructor. */ configure: function( data, url, postData ){ diff --git a/src/rectangle.js b/src/rectangle.js index 1c75ac24..0afef290 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -240,7 +240,7 @@ $.Rect.prototype = { * Determines if two Rectangles have equivalent components. * @function * @param {OpenSeadragon.Rect} rectangle The Rectangle to compare to. - * @return {Boolean} 'true' if all components are equal, otherwise 'false'. + * @returns {Boolean} 'true' if all components are equal, otherwise 'false'. */ equals: function(other) { return (other instanceof $.Rect) && @@ -287,7 +287,7 @@ $.Rect.prototype = { * Returns the smallest rectangle that will contain this and the given * rectangle bounding boxes. * @param {OpenSeadragon.Rect} rect - * @return {OpenSeadragon.Rect} The new rectangle. + * @returns {OpenSeadragon.Rect} The new rectangle. */ union: function(rect) { var thisBoundingBox = this.getBoundingBox(); @@ -313,7 +313,7 @@ $.Rect.prototype = { * Returns the bounding box of the intersection of this rectangle with the * given rectangle. * @param {OpenSeadragon.Rect} rect - * @return {OpenSeadragon.Rect} the bounding box of the intersection + * @returns {OpenSeadragon.Rect} the bounding box of the intersection * or null if the rectangles don't intersect. */ intersection: function(rect) { @@ -441,7 +441,7 @@ $.Rect.prototype = { * @param {Number} degrees The angle in degrees to rotate. * @param {OpenSeadragon.Point} [pivot] The point about which to rotate. * Defaults to the center of the rectangle. - * @return {OpenSeadragon.Rect} + * @returns {OpenSeadragon.Rect} */ rotate: function(degrees, pivot) { degrees = $.positiveModulo(degrees, 360); diff --git a/src/tile.js b/src/tile.js index 45f2823b..81bc8999 100644 --- a/src/tile.js +++ b/src/tile.js @@ -335,7 +335,7 @@ $.Tile.prototype = { * @member {Object} image * @memberof OpenSeadragon.Tile# * @deprecated - * @return {Image} + * @returns {Image} */ get image() { $.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead."); @@ -344,7 +344,7 @@ $.Tile.prototype = { /** * Get the Image object for this tile. - * @return {Image} + * @returns {Image} */ getImage: function() { return this.cacheImageRecord.getImage(); @@ -353,7 +353,7 @@ $.Tile.prototype = { /** * Get the CanvasRenderingContext2D instance for tile image data drawn * onto Canvas if enabled and available - * @return {CanvasRenderingContext2D} + * @returns {CanvasRenderingContext2D} */ getCanvasContext: function() { return this.context2D || this.cacheImageRecord.getRenderedContext(); @@ -469,7 +469,7 @@ $.Tile.prototype = { /** * Get the ratio between current and original size. * @function - * @return {Float} + * @returns {Float} */ getScaleForEdgeSmoothing: function() { var context; @@ -491,7 +491,7 @@ $.Tile.prototype = { * Needed to avoid swimming and twitching. * @function * @param {Number} [scale=1] - Scale to be applied to position. - * @return {OpenSeadragon.Point} + * @returns {OpenSeadragon.Point} */ getTranslationForEdgeSmoothing: function(scale, canvasSize, sketchCanvasSize) { // The translation vector must have positive values, otherwise the image goes a bit off diff --git a/src/tiledimage.js b/src/tiledimage.js index 8e4b14f6..2715730a 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -443,7 +443,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag * @param {Number|OpenSeadragon.Point} viewerX - The X coordinate or point in viewport coordinate system. * @param {Number} [viewerY] - The Y coordinate in viewport coordinate system. * @param {Boolean} [current=false] - Pass true to use the current location; false for target location. - * @return {OpenSeadragon.Point} A point representing the coordinates in the image. + * @returns {OpenSeadragon.Point} A point representing the coordinates in the image. */ viewportToImageCoordinates: function(viewerX, viewerY, current) { var point; @@ -478,7 +478,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag * @param {Number|OpenSeadragon.Point} imageX - The X coordinate or point in image coordinate system. * @param {Number} [imageY] - The Y coordinate in image coordinate system. * @param {Boolean} [current=false] - Pass true to use the current location; false for target location. - * @return {OpenSeadragon.Point} A point representing the coordinates in the viewport. + * @returns {OpenSeadragon.Point} A point representing the coordinates in the viewport. */ imageToViewportCoordinates: function(imageX, imageY, current) { if (imageX instanceof $.Point) { @@ -509,7 +509,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag * @param {Number} [pixelWidth] - The width in pixel of the rectangle. * @param {Number} [pixelHeight] - The height in pixel of the rectangle. * @param {Boolean} [current=false] - Pass true to use the current location; false for target location. - * @return {OpenSeadragon.Rect} A rect representing the coordinates in the viewport. + * @returns {OpenSeadragon.Rect} A rect representing the coordinates in the viewport. */ imageToViewportRectangle: function(imageX, imageY, pixelWidth, pixelHeight, current) { var rect = imageX; @@ -541,7 +541,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag * @param {Number} [pointWidth] - The width in viewport coordinate system. * @param {Number} [pointHeight] - The height in viewport coordinate system. * @param {Boolean} [current=false] - Pass true to use the current location; false for target location. - * @return {OpenSeadragon.Rect} A rect representing the coordinates in the image. + * @returns {OpenSeadragon.Rect} A rect representing the coordinates in the image. */ viewportToImageRectangle: function( viewerX, viewerY, pointWidth, pointHeight, current ) { var rect = viewerX; diff --git a/src/tilesource.js b/src/tilesource.js index 2c99db29..604308ff 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -579,7 +579,7 @@ $.TileSource.prototype = { * @param {String|Object|Array|Document} data * @param {String} url - the url the data was loaded * from if any. - * @return {Boolean} + * @returns {Boolean} */ supports: function( data, url ) { return false; @@ -598,7 +598,7 @@ $.TileSource.prototype = { * from if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null value obtained from * the protocol URL after '#' sign if flag splitHashDataForPost set to 'true' - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure the tile source constructor (include all values you want to * instantiate the TileSource subclass with - what _options_ object should contain). * @throws {Error} @@ -649,7 +649,7 @@ $.TileSource.prototype = { * @param {Number} level * @param {Number} x * @param {Number} y - * @return {*|null} post data to send with tile configuration request + * @returns {*|null} post data to send with tile configuration request */ getTilePostData: function( level, x, y ) { return null; @@ -716,7 +716,7 @@ $.TileSource.prototype = { /** * Decide whether tiles have transparency: this is crucial for correct images blending. - * @return {boolean} true if the image has transparency + * @returns {boolean} true if the image has transparency */ hasTransparency: function(context2D, url, ajaxHeaders, post) { return !!context2D || url.match('.png'); @@ -862,7 +862,7 @@ $.TileSource.prototype = { * Raw data getter * Note that if you override any of *TileCache() functions, you should override all of them. * @param {object} cacheObject context cache object - * @return {*} cache data + * @returns {*} cache data */ getTileCacheData: function(cacheObject) { return cacheObject._data; @@ -874,7 +874,7 @@ $.TileSource.prototype = { * - div HTML rendering relies on image element presence * Note that if you override any of *TileCache() functions, you should override all of them. * @param {object} cacheObject context cache object - * @return {Image} cache data as an Image + * @returns {Image} cache data as an Image */ getTileCacheDataAsImage: function(cacheObject) { return cacheObject._data; //the data itself by default is Image @@ -886,7 +886,7 @@ $.TileSource.prototype = { * convert the data to a canvas and return it's 2D context * Note that if you override any of *TileCache() functions, you should override all of them. * @param {object} cacheObject context cache object - * @return {CanvasRenderingContext2D} context of the canvas representation of the cache data + * @returns {CanvasRenderingContext2D} context of the canvas representation of the cache data */ getTileCacheDataAsContext2D: function(cacheObject) { if (!cacheObject._renderedContext) { diff --git a/src/tmstilesource.js b/src/tmstilesource.js index 00ff284a..f6c8fbef 100644 --- a/src/tmstilesource.js +++ b/src/tmstilesource.js @@ -112,7 +112,7 @@ $.extend( $.TmsTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead * @param {Object} data - the raw configuration * @param {String} url - the url the data was retrieved from if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure this tile sources constructor. */ configure: function( data, url, postData ){ diff --git a/src/viewer.js b/src/viewer.js index ce1d6aef..da1edb16 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -491,7 +491,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {Boolean} + * @returns {Boolean} */ isOpen: function () { return !!this.world.getItemCount(); @@ -529,7 +529,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * of the options parameter for {@link OpenSeadragon.Viewer#addTiledImage}. * @param {Number} initialPage - If sequenceMode is true, display this page initially * for the given tileSources. If specified, will overwrite the Viewer's existing initialPage property. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:open * @fires OpenSeadragon.Viewer.event:open-failed */ @@ -701,7 +701,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:close */ close: function ( ) { @@ -843,7 +843,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {Boolean} + * @returns {Boolean} */ isMouseNavEnabled: function () { return this.innerTracker.isTracking(); @@ -852,7 +852,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function * @param {Boolean} enabled - true to enable, false to disable - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:mouse-enabled */ setMouseNavEnabled: function( enabled ){ @@ -875,7 +875,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {Boolean} + * @returns {Boolean} */ areControlsEnabled: function () { var enabled = this.controls.length, @@ -892,7 +892,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * * @function * @param {Boolean} true to show, false to hide. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:controls-enabled */ setControlsEnabled: function( enabled ) { @@ -933,7 +933,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {Boolean} + * @returns {Boolean} */ isFullPage: function () { return THIS[ this.hash ].fullPage; @@ -945,7 +945,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @function * @param {Boolean} fullPage * If true, enter full page mode. If false, exit full page mode. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:pre-full-page * @fires OpenSeadragon.Viewer.event:full-page */ @@ -1160,7 +1160,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @function * @param {Boolean} fullScreen * If true, enter full screen mode. If false, exit full screen mode. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:pre-full-screen * @fires OpenSeadragon.Viewer.event:full-screen */ @@ -1255,7 +1255,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {Boolean} + * @returns {Boolean} */ isVisible: function () { return this.container.style.visibility !== "hidden"; @@ -1274,7 +1274,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function * @param {Boolean} visible - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:visible */ setVisible: function( visible ){ @@ -1655,7 +1655,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. */ bindSequenceControls: function(){ @@ -1744,7 +1744,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. */ bindStandardControls: function(){ ////////////////////////////////////////////////////////////////////////// @@ -1926,7 +1926,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * Gets the active page of a sequence * @function - * @return {Number} + * @returns {Number} */ currentPage: function() { return this._sequenceIndex; @@ -1934,7 +1934,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** * @function - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:page */ goToPage: function( page ){ @@ -1983,7 +1983,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @param {function} [onDraw] - If supplied the callback is called when the overlay * needs to be drawn. It it the responsibility of the callback to do any drawing/positioning. * It is passed position, size and element. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:add-overlay */ addOverlay: function( element, location, placement, onDraw ) { @@ -2041,7 +2041,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @param {OpenSeadragon.Placement} [placement=OpenSeadragon.Placement.TOP_LEFT] - The position of the * viewport which the location coordinates will be treated as relative * to. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:update-overlay */ updateOverlay: function( element, location, placement ) { @@ -2082,7 +2082,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @method * @param {Element|String} element - A reference to the element or an * element id which represent the ovelay content to be removed. - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:remove-overlay */ removeOverlay: function( element ) { @@ -2118,7 +2118,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * Removes all currently configured Overlays from this Viewer and schedules * an update. * @method - * @return {OpenSeadragon.Viewer} Chainable. + * @returns {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:clear-overlay */ clearOverlays: function() { @@ -2145,7 +2145,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @method * @param {Element|String} element - A reference to the element or an * element id which represents the overlay content. - * @return {OpenSeadragon.Overlay} the matching overlay or null if none found. + * @returns {OpenSeadragon.Overlay} the matching overlay or null if none found. */ getOverlayById: function( element ) { var i; @@ -2226,7 +2226,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * Gets this viewer's gesture settings for the given pointer device type. * @method * @param {String} type - The pointer device type to get the gesture settings for ("mouse", "touch", "pen", etc.). - * @return {OpenSeadragon.GestureSettings} + * @returns {OpenSeadragon.GestureSettings} */ gestureSettingsByDeviceType: function ( type ) { switch ( type ) { diff --git a/src/viewport.js b/src/viewport.js index cd578645..da229885 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -172,7 +172,7 @@ $.Viewport.prototype = { * Updates the viewport's home bounds and constraints for the given content size. * @function * @param {OpenSeadragon.Point} contentSize - size of the content in content units - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:reset-size */ resetContentSize: function(contentSize) { @@ -511,7 +511,7 @@ $.Viewport.prototype = { * @function * @private * @param {OpenSeadragon.Rect} bounds - * @return {OpenSeadragon.Rect} constrained bounds. + * @returns {OpenSeadragon.Rect} constrained bounds. */ _applyBoundaryConstraints: function(bounds) { var newBounds = new $.Rect( @@ -615,7 +615,7 @@ $.Viewport.prototype = { * zooming and panning to the closest acceptable zoom and location. * @function * @param {Boolean} [immediately=false] - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:constrain */ applyConstraints: function(immediately) { @@ -644,7 +644,7 @@ $.Viewport.prototype = { * Equivalent to {@link OpenSeadragon.Viewport#applyConstraints} * @function * @param {Boolean} [immediately=false] - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:constrain */ ensureVisible: function(immediately) { @@ -656,7 +656,7 @@ $.Viewport.prototype = { * @private * @param {OpenSeadragon.Rect} bounds * @param {Object} options (immediately=false, constraints=false) - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ _fitBounds: function(bounds, options) { options = options || {}; @@ -737,7 +737,7 @@ $.Viewport.prototype = { * @function * @param {OpenSeadragon.Rect} bounds * @param {Boolean} [immediately=false] - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ fitBounds: function(bounds, immediately) { return this._fitBounds(bounds, { @@ -756,7 +756,7 @@ $.Viewport.prototype = { * @function * @param {OpenSeadragon.Rect} bounds * @param {Boolean} [immediately=false] - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ fitBoundsWithConstraints: function(bounds, immediately) { return this._fitBounds(bounds, { @@ -768,7 +768,7 @@ $.Viewport.prototype = { /** * Zooms so the image just fills the viewer vertically. * @param {Boolean} immediately - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ fitVertically: function(immediately) { var box = new $.Rect( @@ -782,7 +782,7 @@ $.Viewport.prototype = { /** * Zooms so the image just fills the viewer horizontally. * @param {Boolean} immediately - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ fitHorizontally: function(immediately) { var box = new $.Rect( @@ -798,7 +798,7 @@ $.Viewport.prototype = { * Returns bounds taking constraints into account * Added to improve constrained panning * @param {Boolean} current - Pass true for the current location; defaults to false (target location). - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ getConstrainedBounds: function(current) { var bounds, @@ -815,7 +815,7 @@ $.Viewport.prototype = { * @function * @param {OpenSeadragon.Point} delta * @param {Boolean} immediately - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:pan */ panBy: function( delta, immediately ) { @@ -830,7 +830,7 @@ $.Viewport.prototype = { * @function * @param {OpenSeadragon.Point} center * @param {Boolean} immediately - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:pan */ panTo: function( center, immediately ) { @@ -865,7 +865,7 @@ $.Viewport.prototype = { /** * @function - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:zoom */ zoomBy: function(factor, refPoint, immediately) { @@ -880,7 +880,7 @@ $.Viewport.prototype = { * @param {OpenSeadragon.Point} [refPoint] The point which will stay at * the same screen location. Defaults to the viewport center. * @param {Boolean} [immediately=false] - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:zoom */ zoomTo: function(zoom, refPoint, immediately) { @@ -929,7 +929,7 @@ $.Viewport.prototype = { * @param {Number} degrees The degrees to set the rotation to. * @param {Boolean} [immediately=false] Whether to animate to the new angle * or rotate immediately. - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ setRotation: function(degrees, immediately) { if (!this.viewer || !this.viewer.drawer.canRotate()) { @@ -980,7 +980,7 @@ $.Viewport.prototype = { * Gets the current rotation in degrees. * @function * @param {Boolean} [current=false] True for current rotation, false for target. - * @return {Number} The current rotation in degrees. + * @returns {Number} The current rotation in degrees. */ getRotation: function(current) { return current ? @@ -990,7 +990,7 @@ $.Viewport.prototype = { /** * @function - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. * @fires OpenSeadragon.Viewer.event:resize */ resize: function( newContainerSize, maintain ) { @@ -1241,7 +1241,7 @@ $.Viewport.prototype = { * @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. + * @returns {OpenSeadragon.Point} a point representing the coordinates in the image. */ viewportToImageCoordinates: function(viewerX, viewerY) { if (viewerX instanceof $.Point) { @@ -1287,7 +1287,7 @@ $.Viewport.prototype = { * @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. + * @returns {OpenSeadragon.Point} a point representing the coordinates in the viewport. */ imageToViewportCoordinates: function(imageX, imageY) { if (imageX instanceof $.Point) { @@ -1618,7 +1618,7 @@ $.Viewport.prototype = { /** * Toggles flip state and demands a new drawing on navigator and viewer objects. * @function - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ toggleFlip: function() { this.setFlip(!this.getFlip()); @@ -1628,7 +1628,7 @@ $.Viewport.prototype = { /** * Get flip state stored on viewport. * @function - * @return {Boolean} Flip state. + * @returns {Boolean} Flip state. */ getFlip: function() { return this.flipped; @@ -1638,7 +1638,7 @@ $.Viewport.prototype = { * Sets flip state according to the state input argument. * @function * @param {Boolean} state - Flip state to set. - * @return {OpenSeadragon.Viewport} Chainable. + * @returns {OpenSeadragon.Viewport} Chainable. */ setFlip: function( state ) { if ( this.flipped === state ) { diff --git a/src/zoomifytilesource.js b/src/zoomifytilesource.js index c55b1948..5798d8eb 100644 --- a/src/zoomifytilesource.js +++ b/src/zoomifytilesource.js @@ -123,7 +123,7 @@ * @param {Object} data - the raw configuration * @param {String} url - the url the data was retrieved from if any. * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null - * @return {Object} options - A dictionary of keyword arguments sufficient + * @returns {Object} options - A dictionary of keyword arguments sufficient * to configure this tile sources constructor. */ configure: function(data, url, postData) { From 476657ecad567e2850a53e75259e58c840a6a392 Mon Sep 17 00:00:00 2001 From: Joe DF <3848219+joedf@users.noreply.github.com> Date: Mon, 10 Oct 2022 15:12:30 -0400 Subject: [PATCH 02/12] undefined check for obj. descriptor --- src/openseadragon.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 685ef10f..04184d4e 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1102,12 +1102,17 @@ function OpenSeadragon( options ){ // Extend the base object for ( name in options ) { var descriptor = Object.getOwnPropertyDescriptor(options, name); - if (descriptor.get || descriptor.set) { - Object.defineProperty(target, name, descriptor); - continue; - } - copy = descriptor.value; + if (descriptor !== undefined) { + if (descriptor.get || descriptor.set) { + Object.defineProperty(target, name, descriptor); + continue; + } + + copy = descriptor.value; + } else { + $.console.warn('Undefined descriptior obtained for the "' + name + '" property in extended object.'); + } // Prevent never-ending loop if ( target === copy ) { From 1a1b8e451091357613a21c9b7bee0f44268086f4 Mon Sep 17 00:00:00 2001 From: "james.sullivan" Date: Thu, 13 Oct 2022 17:36:50 -0400 Subject: [PATCH 03/12] v3.2.0-pre --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5cd50bf5..5658b4d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openseadragon", - "version": "3.1.0", + "version": "3.2.0-pre", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "keywords": [ "image", @@ -47,4 +47,4 @@ "test": "grunt test", "prepare": "grunt build" } -} \ No newline at end of file +} From f87310c0825b8909a1c498849bb4abd87eae9441 Mon Sep 17 00:00:00 2001 From: "james.sullivan" Date: Fri, 14 Oct 2022 10:47:48 -0400 Subject: [PATCH 04/12] Fix initilization crash caused by Extend and buttons getter --- src/viewer.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index ce1d6aef..a4dc274f 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -181,9 +181,6 @@ $.Viewer = function( options ) { //TODO: rename navImages to uiImages navImages: null, - //interface button controls - buttons: null, - //TODO: this is defunct so safely remove it profiler: null From 333be9d6ca902e1e5fc67a6f5433dd9ced588101 Mon Sep 17 00:00:00 2001 From: "james.sullivan" Date: Fri, 14 Oct 2022 10:51:56 -0400 Subject: [PATCH 05/12] Remove version bump --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5658b4d8..5cd50bf5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openseadragon", - "version": "3.2.0-pre", + "version": "3.1.0", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "keywords": [ "image", @@ -47,4 +47,4 @@ "test": "grunt test", "prepare": "grunt build" } -} +} \ No newline at end of file From 98972d22d1037ce4d1097385c92467396917076b Mon Sep 17 00:00:00 2001 From: Shyamkumar Yadav <46707211+shyamkumaryadav@users.noreply.github.com> Date: Wed, 19 Oct 2022 10:25:37 +0530 Subject: [PATCH 06/12] docs: fix a jsdoc --- src/iiiftilesource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iiiftilesource.js b/src/iiiftilesource.js index 564d7833..632974a6 100644 --- a/src/iiiftilesource.js +++ b/src/iiiftilesource.js @@ -456,7 +456,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea * @param {Object} options * @param {Array|String} options.profile * @param {Number} options.version - * @param {String} options.extraFeatures + * @param {String[]} options.extraFeatures * @returns {Boolean} */ function canBeTiled ( options ) { From 8bb600f6ae74bfab893068c59e4ae88cc27abd5a Mon Sep 17 00:00:00 2001 From: Jimmy Sullivan Date: Wed, 19 Oct 2022 11:35:08 -0400 Subject: [PATCH 07/12] Update viewer.js Change removing buttons, to renaming it buttonGroup --- src/viewer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index a4dc274f..54a3f2ba 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -180,6 +180,9 @@ $.Viewer = function( options ) { //UI image resources //TODO: rename navImages to uiImages navImages: null, + + //interface button controls + buttonGroup: null, //TODO: this is defunct so safely remove it profiler: null From 13330c4edec74ee440dff2f68241485e3e716e94 Mon Sep 17 00:00:00 2001 From: Jimmy Sullivan Date: Wed, 19 Oct 2022 11:35:49 -0400 Subject: [PATCH 08/12] Update viewer.js Remove erroneous whitespace --- src/viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index 54a3f2ba..a72ab59b 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -180,7 +180,7 @@ $.Viewer = function( options ) { //UI image resources //TODO: rename navImages to uiImages navImages: null, - + //interface button controls buttonGroup: null, From aec24d6dd78bd7ffd4ce293c0cc4b89933080df8 Mon Sep 17 00:00:00 2001 From: Joe DF <3848219+joedf@users.noreply.github.com> Date: Wed, 19 Oct 2022 16:07:35 -0400 Subject: [PATCH 09/12] add continue, update warning msg --- src/openseadragon.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 04184d4e..45b36da7 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1111,7 +1111,8 @@ function OpenSeadragon( options ){ copy = descriptor.value; } else { - $.console.warn('Undefined descriptior obtained for the "' + name + '" property in extended object.'); + $.console.warn('Could not copy inherited property "' + name + '".'); + continue; } // Prevent never-ending loop From 38027e7588dabf73cd26cde45f7c21d81043a714 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 20 Oct 2022 14:23:27 -0700 Subject: [PATCH 10/12] Changelog for #2211 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 71df95e2..e00615ee 100644 --- a/changelog.txt +++ b/changelog.txt @@ -9,6 +9,7 @@ OPENSEADRAGON CHANGELOG * You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf) * Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson) * We now delegate tile fetching and caching to the TileSource, to allow for custom tile formats (#2148 @Aiosa) +* Improved documentation (#2211 @shyamkumaryadav) * Fixed: Cropping tiled images with polygons was broken (#2183 @altert) * Fixed: Disabling buttons only changed their appearance, but they were still clickable (#2187 @pearcetm) * Fixed: ImageTileSource produced an error having to do with getTileHashKey (#2190 @Aiosa) From c470e7effd4b3a7533070cc2758b0d6e1db115fa Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 20 Oct 2022 14:29:06 -0700 Subject: [PATCH 11/12] Changelog for #2219 --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index e00615ee..f5e12ffd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,7 +13,7 @@ OPENSEADRAGON CHANGELOG * Fixed: Cropping tiled images with polygons was broken (#2183 @altert) * Fixed: Disabling buttons only changed their appearance, but they were still clickable (#2187 @pearcetm) * Fixed: ImageTileSource produced an error having to do with getTileHashKey (#2190 @Aiosa) -* Fixed: On startup you would get an unnecessary "Viewer.buttons is deprecated" warning (#2201 @joedf) +* Fixed: On startup you would get an unnecessary "Viewer.buttons is deprecated" warning (#2201 @joedf, #2219 @jssullivan) 3.1.0: From ed66c2d1518e919dffa335e68c34f469607273b3 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 24 Oct 2022 14:17:51 -0700 Subject: [PATCH 12/12] Changelog for #2212 --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index f5e12ffd..7aa62ab1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,7 +13,7 @@ OPENSEADRAGON CHANGELOG * Fixed: Cropping tiled images with polygons was broken (#2183 @altert) * Fixed: Disabling buttons only changed their appearance, but they were still clickable (#2187 @pearcetm) * Fixed: ImageTileSource produced an error having to do with getTileHashKey (#2190 @Aiosa) -* Fixed: On startup you would get an unnecessary "Viewer.buttons is deprecated" warning (#2201 @joedf, #2219 @jssullivan) +* Fixed: On startup you would get an unnecessary "Viewer.buttons is deprecated" warning (#2201 @joedf, #2219 @jssullivan, #2212 @joedf) 3.1.0: