mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 17:21:50 +03:00
Add asserts on this.viewer.
This commit is contained in:
parent
b1a0abd104
commit
65a95d4a49
@ -1277,8 +1277,10 @@ $.Viewport.prototype = {
|
||||
* @returns {OpenSeadragon.Point}
|
||||
*/
|
||||
windowToImageCoordinates: function(pixel) {
|
||||
$.console.assert(this.viewer,
|
||||
"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");
|
||||
var viewerCoordinates = pixel.minus(
|
||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
||||
$.getElementPosition(this.viewer.element));
|
||||
return this.viewerElementToImageCoordinates(viewerCoordinates);
|
||||
},
|
||||
|
||||
@ -1289,9 +1291,11 @@ $.Viewport.prototype = {
|
||||
* @returns {OpenSeadragon.Point}
|
||||
*/
|
||||
imageToWindowCoordinates: function(pixel) {
|
||||
$.console.assert(this.viewer,
|
||||
"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");
|
||||
var viewerCoordinates = this.imageToViewerElementCoordinates(pixel);
|
||||
return viewerCoordinates.plus(
|
||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
||||
$.getElementPosition(this.viewer.element));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1348,8 +1352,10 @@ $.Viewport.prototype = {
|
||||
* @returns {OpenSeadragon.Point}
|
||||
*/
|
||||
windowToViewportCoordinates: function(pixel) {
|
||||
$.console.assert(this.viewer,
|
||||
"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");
|
||||
var viewerCoordinates = pixel.minus(
|
||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
||||
$.getElementPosition(this.viewer.element));
|
||||
return this.viewerElementToViewportCoordinates(viewerCoordinates);
|
||||
},
|
||||
|
||||
@ -1359,9 +1365,11 @@ $.Viewport.prototype = {
|
||||
* @returns {OpenSeadragon.Point}
|
||||
*/
|
||||
viewportToWindowCoordinates: function(point) {
|
||||
$.console.assert(this.viewer,
|
||||
"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");
|
||||
var viewerCoordinates = this.viewportToViewerElementCoordinates(point);
|
||||
return viewerCoordinates.plus(
|
||||
OpenSeadragon.getElementPosition( this.viewer.element ));
|
||||
$.getElementPosition(this.viewer.element));
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user