mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-20 01:31:45 +03:00
Add asserts on this.viewer.
This commit is contained in:
parent
b1a0abd104
commit
65a95d4a49
@ -1276,10 +1276,12 @@ $.Viewport.prototype = {
|
|||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
windowToImageCoordinates: function( pixel ) {
|
windowToImageCoordinates: function(pixel) {
|
||||||
|
$.console.assert(this.viewer,
|
||||||
|
"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");
|
||||||
var viewerCoordinates = pixel.minus(
|
var viewerCoordinates = pixel.minus(
|
||||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
$.getElementPosition(this.viewer.element));
|
||||||
return this.viewerElementToImageCoordinates( viewerCoordinates );
|
return this.viewerElementToImageCoordinates(viewerCoordinates);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1288,10 +1290,12 @@ $.Viewport.prototype = {
|
|||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
imageToWindowCoordinates: function( pixel ) {
|
imageToWindowCoordinates: function(pixel) {
|
||||||
var viewerCoordinates = this.imageToViewerElementCoordinates( pixel );
|
$.console.assert(this.viewer,
|
||||||
|
"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");
|
||||||
|
var viewerCoordinates = this.imageToViewerElementCoordinates(pixel);
|
||||||
return viewerCoordinates.plus(
|
return viewerCoordinates.plus(
|
||||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
$.getElementPosition(this.viewer.element));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1347,10 +1351,12 @@ $.Viewport.prototype = {
|
|||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
windowToViewportCoordinates: function( pixel ) {
|
windowToViewportCoordinates: function(pixel) {
|
||||||
|
$.console.assert(this.viewer,
|
||||||
|
"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");
|
||||||
var viewerCoordinates = pixel.minus(
|
var viewerCoordinates = pixel.minus(
|
||||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
$.getElementPosition(this.viewer.element));
|
||||||
return this.viewerElementToViewportCoordinates( viewerCoordinates );
|
return this.viewerElementToViewportCoordinates(viewerCoordinates);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1358,10 +1364,12 @@ $.Viewport.prototype = {
|
|||||||
* @param {OpenSeadragon.Point} point
|
* @param {OpenSeadragon.Point} point
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
viewportToWindowCoordinates: function( point ) {
|
viewportToWindowCoordinates: function(point) {
|
||||||
var viewerCoordinates = this.viewportToViewerElementCoordinates( point );
|
$.console.assert(this.viewer,
|
||||||
|
"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");
|
||||||
|
var viewerCoordinates = this.viewportToViewerElementCoordinates(point);
|
||||||
return viewerCoordinates.plus(
|
return viewerCoordinates.plus(
|
||||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
$.getElementPosition(this.viewer.element));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user