Merge branch 'master' into ig-test

This commit is contained in:
Ian Gilman 2022-11-21 17:16:45 -08:00
commit cdfd5a454b
23 changed files with 5741 additions and 12781 deletions

View File

@ -3,20 +3,20 @@
OpenSeadragon is truly a community project; we welcome your involvement!
When contributing, please attempt to match the code style already in the codebase.
However, we are in the process of changing our code style (see issue [#456](https://github.com/openseadragon/openseadragon/issues/456)), so avoid spaces inside parentheses and square brackets. Note that we use four spaces per indentation stop. For easier setup you can also install [EditorConfig](http://editorconfig.org/) if your IDE is supported. For more thoughts on code style, see [idiomatic.js](https://github.com/rwldrn/idiomatic.js/).
However, we are in the process of changing our code style (see issue [#456](https://github.com/openseadragon/openseadragon/issues/456)), so avoid spaces inside parentheses and square brackets. Note that we use four spaces per indentation stop. For easier setup you can also install [EditorConfig](https://editorconfig.org/) if your IDE is supported. For more thoughts on code style, see [idiomatic.js](https://github.com/rwldrn/idiomatic.js/).
When fixing bugs and adding features, when appropriate please also:
* Update related doc comments (we use [JSDoc 3](http://usejsdoc.org/))
* Update related doc comments (we use [JSDoc 3](https://jsdoc.app/))
* Add/update related unit tests
If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water.
If you're new to the project, check out our [good first issues](https://github.com/openseadragon/openseadragon/issues?labels=good+first+issue&page=1&state=open) for some places to dip your toe in the water.
If you're new to open source in general, check out [GitHub's open source intro guide](https://guides.github.com/activities/contributing-to-open-source/).
### First Time Setup
All command-line operations for building and testing OpenSeadragon are scripted using [Grunt](http://gruntjs.com/) which is based on [Node.js](http://nodejs.org/). To get set up:
All command-line operations for building and testing OpenSeadragon are scripted using [Grunt](https://gruntjs.com/) which is based on [Node.js](https://nodejs.org/). To get set up:
1. Install Node, if you haven't already (available at the link above)
1. Install the Grunt command line runner (if you haven't already); on the command line, run `npm install -g grunt-cli`
@ -57,7 +57,7 @@ You can also publish the built version to the site-build repository. This assume
### Testing
Our tests are based on [QUnit](http://qunitjs.com/) and [Puppeteer](https://github.com/GoogleChrome/puppeteer); they're both installed when you run `npm install`. To run on the command line:
Our tests are based on [QUnit](https://qunitjs.com/) and [Puppeteer](https://github.com/GoogleChrome/puppeteer); they're both installed when you run `npm install`. To run on the command line:
grunt test

View File

@ -1,18 +1,29 @@
# OpenSeadragon
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/openseadragon/openseadragon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://secure.travis-ci.org/openseadragon/openseadragon.png?branch=master)](http://travis-ci.org/openseadragon/openseadragon)
<!-- [![Gitter][gitter-badge]][gitter]
[![Build Status][build-badge]][build] -->
An open-source, web-based viewer for zoomable images, implemented in pure JavaScript.
See it in action and get started using it at [http://openseadragon.github.io/](http://openseadragon.github.io/).
See it in action and get started using it at [https://openseadragon.github.io/][openseadragon].
## Stable Builds
See the [GitHub releases page](https://github.com/openseadragon/openseadragon/releases).
See the [GitHub releases page][github-releases].
## Development
If you want to use OpenSeadragon in your own projects, you can find the latest stable build, API documentation, and example code at [http://openseadragon.github.io/](http://openseadragon.github.io/). If you want to modify OpenSeadragon and/or contribute to its development, read the [contributing guide](https://github.com/openseadragon/openseadragon/blob/master/CONTRIBUTING.md) for instructions.
If you want to use OpenSeadragon in your own projects, you can find the latest stable build, API documentation, and example code at [https://openseadragon.github.io/][openseadragon]. If you want to modify OpenSeadragon and/or contribute to its development, read the [contributing guide][github-contributing] for instructions.
## License
OpenSeadragon is released under the New BSD license. For details, see the [LICENSE.txt file](https://github.com/openseadragon/openseadragon/blob/master/LICENSE.txt).
OpenSeadragon is released under the New BSD license. For details, see the [LICENSE.txt file][github-license].
[openseadragon]: https://openseadragon.github.io/
<!-- [gitter-badge]: https://badges.gitter.im/Join%20Chat.svg
[gitter]: https://gitter.im/openseadragon/openseadragon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[build-badge]: https://secure.travis-ci.org/openseadragon/openseadragon.png?branch=master
[build]: https://travis-ci.org/openseadragon/openseadragon -->
[github-releases]: https://github.com/openseadragon/openseadragon/releases
[github-contributing]: https://github.com/openseadragon/openseadragon/blob/master/CONTRIBUTING.md
[github-license]: https://github.com/openseadragon/openseadragon/blob/master/LICENSE.txt

View File

@ -5,13 +5,16 @@ OPENSEADRAGON CHANGELOG
* NEW BEHAVIOR: Setting the viewport rotation now animates by default (pass false for the new immediately parameter to disable) (#2136 @jonasengelmann)
* DEPRECATION: Don't access the viewport's degrees property directly anymore; instead use setRotation and getRotation (#2136 @jonasengelmann)
* New gesture: Double-click and drag to zoom (on by default for touch) (#2225 @HamzaTatheer)
* Improved the constraints that keep the image in the viewer, specifically when zoomed out a lot (#2160 @joedf)
* 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)
* Fixed: On startup you would get an unnecessary "Viewer.buttons is deprecated" warning (#2201 @joedf, #2219 @jssullivan, #2212 @joedf)
3.1.0:

18162
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,7 @@ $.ControlAnchor = {
* @param {Element} container - the element to control will be anchored too.
*/
$.Control = function ( element, options, container ) {
var parent = element.parentNode;
if (typeof options === 'number')
{
@ -150,6 +151,7 @@ $.Control = function ( element, options, container ) {
} else {
parent.appendChild( this.wrapper );
}
};
/** @lends OpenSeadragon.Control.prototype */
@ -169,7 +171,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";

View File

@ -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;

View File

@ -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);

View File

@ -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 ){

View File

@ -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 ];

View File

@ -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 <caption>IIIF 2.x Info Looks like this</caption>
* {
* "@context": "http://iiif.io/api/image/2/context.json",
@ -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 ) {

View File

@ -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) {

View File

@ -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 ){

View File

@ -341,6 +341,9 @@
* @property {Boolean} [gestureSettingsMouse.clickToZoom=true] - Zoom on click gesture
* @property {Boolean} [gestureSettingsMouse.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
* then clickToZoom should be set to false to prevent multiple zooms.
* @property {Boolean} [gestureSettingsMouse.dblClickDragToZoom=false] - Zoom on dragging through
* double-click gesture ( single click and next click to drag). Note: If set to true
* then clickToZoom should be set to false to prevent multiple zooms.
* @property {Boolean} [gestureSettingsMouse.pinchToZoom=false] - Zoom on pinch gesture
* @property {Boolean} [gestureSettingsMouse.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
* the zoom is centered at the canvas center.
@ -356,6 +359,10 @@
* @property {Boolean} [gestureSettingsTouch.clickToZoom=false] - Zoom on click gesture
* @property {Boolean} [gestureSettingsTouch.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
* then clickToZoom should be set to false to prevent multiple zooms.
* @property {Boolean} [gestureSettingsTouch.dblClickDragToZoom=true] - Zoom on dragging through
* double-click gesture ( single click and next click to drag). Note: If set to true
* then clickToZoom should be set to false to prevent multiple zooms.
* @property {Boolean} [gestureSettingsTouch.pinchToZoom=true] - Zoom on pinch gesture
* @property {Boolean} [gestureSettingsTouch.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
* the zoom is centered at the canvas center.
@ -386,6 +393,9 @@
* @property {Boolean} [gestureSettingsUnknown.clickToZoom=false] - Zoom on click gesture
* @property {Boolean} [gestureSettingsUnknown.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
* then clickToZoom should be set to false to prevent multiple zooms.
* @property {Boolean} [gestureSettingsUnknown.dblClickDragToZoom=false] - Zoom on dragging through
* double-click gesture ( single click and next click to drag). Note: If set to true
* then clickToZoom should be set to false to prevent multiple zooms.
* @property {Boolean} [gestureSettingsUnknown.pinchToZoom=true] - Zoom on pinch gesture
* @property {Boolean} [gestureSettingsUnknown.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
* the zoom is centered at the canvas center.
@ -400,6 +410,9 @@
* @property {Number} [zoomPerScroll=1.2]
* The "zoom distance" per mouse scroll or touch pinch. <em><strong>Note:</strong> Setting this to 1.0 effectively disables the mouse-wheel zoom feature (also see gestureSettings[Mouse|Touch|Pen].scrollToZoom}).</em>
*
* @property {Number} [zoomPerDblClickDrag=1.2]
* The "zoom distance" per double-click mouse drag. <em><strong>Note:</strong> Setting this to 1.0 effectively disables the double-click-drag-to-Zoom feature (also see gestureSettings[Mouse|Touch|Pen].dblClickDragToZoom).</em>
*
* @property {Number} [zoomPerSecond=1.0]
* Sets the zoom amount per second when zoomIn/zoomOut buttons are pressed and held.
* The value is a factor of the current zoom, so 1.0 (the default) disables zooming when the zoomIn/zoomOut buttons
@ -922,7 +935,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) {
@ -1101,8 +1114,19 @@ function OpenSeadragon( options ){
if ( options !== null || options !== undefined ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
var descriptor = Object.getOwnPropertyDescriptor(options, name);
if (descriptor !== undefined) {
if (descriptor.get || descriptor.set) {
Object.defineProperty(target, name, descriptor);
continue;
}
copy = descriptor.value;
} else {
$.console.warn('Could not copy inherited property "' + name + '".');
continue;
}
// Prevent never-ending loop
if ( target === copy ) {
@ -1111,6 +1135,8 @@ function OpenSeadragon( options ){
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( OpenSeadragon.isPlainObject( copy ) || ( copyIsArray = OpenSeadragon.isArray( copy ) ) ) ) {
src = target[ name ];
if ( copyIsArray ) {
copyIsArray = false;
clone = src && OpenSeadragon.isArray( src ) ? src : [];
@ -1190,6 +1216,7 @@ function OpenSeadragon( options ){
scrollToZoom: true,
clickToZoom: true,
dblClickToZoom: false,
dblClickDragToZoom: false,
pinchToZoom: false,
zoomToRefPoint: true,
flickEnabled: false,
@ -1202,6 +1229,7 @@ function OpenSeadragon( options ){
scrollToZoom: false,
clickToZoom: false,
dblClickToZoom: true,
dblClickDragToZoom: true,
pinchToZoom: true,
zoomToRefPoint: true,
flickEnabled: true,
@ -1214,6 +1242,7 @@ function OpenSeadragon( options ){
scrollToZoom: false,
clickToZoom: true,
dblClickToZoom: false,
dblClickDragToZoom: false,
pinchToZoom: false,
zoomToRefPoint: true,
flickEnabled: false,
@ -1226,6 +1255,7 @@ function OpenSeadragon( options ){
scrollToZoom: false,
clickToZoom: false,
dblClickToZoom: true,
dblClickDragToZoom: false,
pinchToZoom: true,
zoomToRefPoint: true,
flickEnabled: true,
@ -1235,6 +1265,7 @@ function OpenSeadragon( options ){
},
zoomPerClick: 2,
zoomPerScroll: 1.2,
zoomPerDblClickDrag: 1.2,
zoomPerSecond: 1.0,
blendTime: 0,
alwaysBlend: false,
@ -2102,7 +2133,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;
@ -2266,7 +2297,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);

View File

@ -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 ){

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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 ){

View File

@ -182,7 +182,7 @@ $.Viewer = function( options ) {
navImages: null,
//interface button controls
buttons: null,
buttonGroup: null,
//TODO: this is defunct so safely remove it
profiler: null
@ -212,7 +212,9 @@ $.Viewer = function( options ) {
zoomFactor: null,
lastZoomTime: null,
fullPage: false,
onfullscreenchange: null
onfullscreenchange: null,
lastClickTime: null,
draggingToZoom: false,
};
this._sequenceIndex = 0;
@ -491,7 +493,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {Boolean}
* @returns {Boolean}
*/
isOpen: function () {
return !!this.world.getItemCount();
@ -529,7 +531,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 +703,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 +845,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {Boolean}
* @returns {Boolean}
*/
isMouseNavEnabled: function () {
return this.innerTracker.isTracking();
@ -852,7 +854,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 +877,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {Boolean}
* @returns {Boolean}
*/
areControlsEnabled: function () {
var enabled = this.controls.length,
@ -892,7 +894,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 +935,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {Boolean}
* @returns {Boolean}
*/
isFullPage: function () {
return THIS[ this.hash ].fullPage;
@ -945,7 +947,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 +1162,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 +1257,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {Boolean}
* @returns {Boolean}
*/
isVisible: function () {
return this.container.style.visibility !== "hidden";
@ -1274,7 +1276,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 +1657,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {OpenSeadragon.Viewer} Chainable.
* @returns {OpenSeadragon.Viewer} Chainable.
*/
bindSequenceControls: function(){
@ -1744,7 +1746,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* @function
* @return {OpenSeadragon.Viewer} Chainable.
* @returns {OpenSeadragon.Viewer} Chainable.
*/
bindStandardControls: function(){
//////////////////////////////////////////////////////////////////////////
@ -1926,7 +1928,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 +1936,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 +1985,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 +2043,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 +2084,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 +2120,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 +2147,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 +2228,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 ) {
@ -2854,6 +2856,8 @@ function onCanvasKeyPress( event ) {
}
}
function onCanvasClick( event ) {
var gestureSettings;
@ -2893,17 +2897,31 @@ function onCanvasClick( event ) {
* @property {Boolean} preventDefaultAction - Set to true to prevent default click to zoom behaviour. Default: false.
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.raiseEvent( 'canvas-click', canvasClickEventArgs);
if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) {
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if ( gestureSettings.clickToZoom ) {
if (gestureSettings.clickToZoom === true){
this.viewport.zoomBy(
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null
);
this.viewport.applyConstraints();
}
if( gestureSettings.dblClickDragToZoom){
if(THIS[ this.hash ].draggingToZoom === true){
THIS[ this.hash ].lastClickTime = null;
THIS[ this.hash ].draggingToZoom = false;
}
else{
THIS[ this.hash ].lastClickTime = $.now();
}
}
}
}
@ -2983,43 +3001,52 @@ function onCanvasDrag( event ) {
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if ( gestureSettings.dragToPan && !canvasDragEventArgs.preventDefaultAction && this.viewport ) {
if( !this.panHorizontal ){
event.delta.x = 0;
if(!canvasDragEventArgs.preventDefaultAction && this.viewport){
if (gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom){
var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y / 50);
this.viewport.zoomBy(factor);
}
if( !this.panVertical ){
event.delta.y = 0;
}
if(this.viewport.flipped){
event.delta.x = -event.delta.x;
}
if( this.constrainDuringPan ){
var delta = this.viewport.deltaPointsFromPixels( event.delta.negate() );
this.viewport.centerSpringX.target.value += delta.x;
this.viewport.centerSpringY.target.value += delta.y;
var bounds = this.viewport.getBounds();
var constrainedBounds = this.viewport.getConstrainedBounds();
this.viewport.centerSpringX.target.value -= delta.x;
this.viewport.centerSpringY.target.value -= delta.y;
if (bounds.x !== constrainedBounds.x) {
else if (gestureSettings.dragToPan && !THIS[ this.hash ].draggingToZoom) {
if( !this.panHorizontal ){
event.delta.x = 0;
}
if (bounds.y !== constrainedBounds.y) {
if( !this.panVertical ){
event.delta.y = 0;
}
if(this.viewport.flipped){
event.delta.x = -event.delta.x;
}
if( this.constrainDuringPan ){
var delta = this.viewport.deltaPointsFromPixels( event.delta.negate() );
this.viewport.centerSpringX.target.value += delta.x;
this.viewport.centerSpringY.target.value += delta.y;
var bounds = this.viewport.getBounds();
var constrainedBounds = this.viewport.getConstrainedBounds();
this.viewport.centerSpringX.target.value -= delta.x;
this.viewport.centerSpringY.target.value -= delta.y;
if (bounds.x !== constrainedBounds.x) {
event.delta.x = 0;
}
if (bounds.y !== constrainedBounds.y) {
event.delta.y = 0;
}
}
this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled && !this.constrainDuringPan);
}
this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled && !this.constrainDuringPan);
}
}
function onCanvasDragEnd( event ) {
var gestureSettings;
var canvasDragEndEventArgs = {
tracker: event.eventSource,
pointerType: event.pointerType,
@ -3050,9 +3077,11 @@ function onCanvasDragEnd( event ) {
*/
this.raiseEvent('canvas-drag-end', canvasDragEndEventArgs);
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if (!canvasDragEndEventArgs.preventDefaultAction && this.viewport) {
var gestureSettings = this.gestureSettingsByDeviceType(event.pointerType);
if (gestureSettings.flickEnabled &&
if ( !THIS[ this.hash ].draggingToZoom &&
gestureSettings.flickEnabled &&
event.speed >= gestureSettings.flickMinSpeed) {
var amplitudeX = 0;
if (this.panHorizontal) {
@ -3072,6 +3101,13 @@ function onCanvasDragEnd( event ) {
}
this.viewport.applyConstraints();
}
if( gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
THIS[ this.hash ].draggingToZoom = false;
}
}
function onCanvasEnter( event ) {
@ -3135,6 +3171,8 @@ function onCanvasLeave( event ) {
}
function onCanvasPress( event ) {
var gestureSettings;
/**
* Raised when the primary mouse button is pressed or touch starts on the {@link OpenSeadragon.Viewer#canvas} element.
*
@ -3158,6 +3196,24 @@ function onCanvasPress( event ) {
insideElementReleased: event.insideElementReleased,
originalEvent: event.originalEvent
});
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if ( gestureSettings.dblClickDragToZoom ){
var lastClickTime = THIS[ this.hash ].lastClickTime;
var currClickTime = $.now();
if ( lastClickTime === null) {
return;
}
if ((currClickTime - lastClickTime) < this.dblClickTimeThreshold) {
THIS[ this.hash ].draggingToZoom = true;
}
THIS[ this.hash ].lastClickTime = null;
}
}
function onCanvasRelease( event ) {

View File

@ -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 ) {

View File

@ -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) {