Rename scale functions with NoRotate suffix.

This commit is contained in:
Antoine Vandecreme 2015-12-22 18:19:22 -05:00
parent 764d8f6f2c
commit ebbf4ea4a0
4 changed files with 26 additions and 26 deletions

View File

@ -273,8 +273,8 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
* @return {OpenSeadragon.Rect} Rectangle in drawer coordinate system. * @return {OpenSeadragon.Rect} Rectangle in drawer coordinate system.
*/ */
viewportToDrawerRectangle: function(rectangle) { viewportToDrawerRectangle: function(rectangle) {
var topLeft = this.viewport.scalePixelFromPoint(rectangle.getTopLeft(), true); var topLeft = this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(), true);
var size = this.viewport.scaleDeltaPixelsFromPoints(rectangle.getSize(), true); var size = this.viewport.deltaPixelsFromPointsNoRotate(rectangle.getSize(), true);
return new $.Rect( return new $.Rect(
topLeft.x * $.pixelDensityRatio, topLeft.x * $.pixelDensityRatio,

View File

@ -307,8 +307,8 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
if( viewport && this.viewport ) { if( viewport && this.viewport ) {
bounds = viewport.getBounds( true ); bounds = viewport.getBounds( true );
topleft = this.viewport.scalePixelFromPoint(bounds.getTopLeft(), false); topleft = this.viewport.pixelFromPointNoRotate(bounds.getTopLeft(), false);
bottomright = this.viewport.scalePixelFromPoint(bounds.getBottomRight(), false) bottomright = this.viewport.pixelFromPointNoRotate(bounds.getBottomRight(), false)
.minus( this.totalBorderWidths ); .minus( this.totalBorderWidths );
//update style for navigator-box //update style for navigator-box

View File

@ -652,7 +652,7 @@ function updateViewport( tiledImage ) {
haveDrawn = false, haveDrawn = false,
currentTime = $.now(), currentTime = $.now(),
viewportBounds = tiledImage.viewport.getBoundsWithMargins( true ), viewportBounds = tiledImage.viewport.getBoundsWithMargins( true ),
zeroRatioC = tiledImage.viewport.scaleDeltaPixelsFromPoints( zeroRatioC = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( 0 ), tiledImage.source.getPixelRatio( 0 ),
true true
).x * tiledImage._scaleSpring.current.value, ).x * tiledImage._scaleSpring.current.value,
@ -733,7 +733,7 @@ function updateViewport( tiledImage ) {
drawLevel = false; drawLevel = false;
//Avoid calculations for draw if we have already drawn this //Avoid calculations for draw if we have already drawn this
renderPixelRatioC = tiledImage.viewport.scaleDeltaPixelsFromPoints( renderPixelRatioC = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( level ), tiledImage.source.getPixelRatio( level ),
true true
).x * tiledImage._scaleSpring.current.value; ).x * tiledImage._scaleSpring.current.value;
@ -747,12 +747,12 @@ function updateViewport( tiledImage ) {
} }
//Perform calculations for draw if we haven't drawn this //Perform calculations for draw if we haven't drawn this
renderPixelRatioT = tiledImage.viewport.scaleDeltaPixelsFromPoints( renderPixelRatioT = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( level ), tiledImage.source.getPixelRatio( level ),
false false
).x * tiledImage._scaleSpring.current.value; ).x * tiledImage._scaleSpring.current.value;
zeroRatioT = tiledImage.viewport.scaleDeltaPixelsFromPoints( zeroRatioT = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( tiledImage.source.getPixelRatio(
Math.max( Math.max(
tiledImage.source.getClosestLevel( tiledImage.viewport.containerSize ) - 1, tiledImage.source.getClosestLevel( tiledImage.viewport.containerSize ) - 1,
@ -1140,10 +1140,10 @@ function positionTile( tile, overlap, viewport, viewportCenter, levelVisibility,
boundsSize.x *= tiledImage._scaleSpring.current.value; boundsSize.x *= tiledImage._scaleSpring.current.value;
boundsSize.y *= tiledImage._scaleSpring.current.value; boundsSize.y *= tiledImage._scaleSpring.current.value;
var positionC = viewport.scalePixelFromPoint(boundsTL, true), var positionC = viewport.pixelFromPointNoRotate(boundsTL, true),
positionT = viewport.scalePixelFromPoint(boundsTL, false), positionT = viewport.pixelFromPointNoRotate(boundsTL, false),
sizeC = viewport.scaleDeltaPixelsFromPoints(boundsSize, true), sizeC = viewport.deltaPixelsFromPointsNoRotate(boundsSize, true),
sizeT = viewport.scaleDeltaPixelsFromPoints(boundsSize, false), sizeT = viewport.deltaPixelsFromPointsNoRotate(boundsSize, false),
tileCenter = positionT.plus( sizeT.divide( 2 ) ), tileCenter = positionT.plus( sizeT.divide( 2 ) ),
tileDistance = viewportCenter.distanceTo( tileCenter ); tileDistance = viewportCenter.distanceTo( tileCenter );

View File

@ -931,7 +931,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
}, },
/** /**
* Scale a delta (translation vector) from viewport coordinates to pixels * Convert a delta (translation vector) from viewport coordinates to pixels
* coordinates. This method does not take rotation into account. * coordinates. This method does not take rotation into account.
* Consider using deltaPixelsFromPoints if you need to account for rotation. * Consider using deltaPixelsFromPoints if you need to account for rotation.
* @param {OpenSeadragon.Point} deltaPoints - The translation vector to convert. * @param {OpenSeadragon.Point} deltaPoints - The translation vector to convert.
@ -939,7 +939,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location). * defaults to false (target location).
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
scaleDeltaPixelsFromPoints: function(deltaPoints, current) { deltaPixelsFromPointsNoRotate: function(deltaPoints, current) {
return deltaPoints.times( return deltaPoints.times(
this._containerInnerSize.x * this.getZoom(current) this._containerInnerSize.x * this.getZoom(current)
); );
@ -954,13 +954,13 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
deltaPixelsFromPoints: function(deltaPoints, current) { deltaPixelsFromPoints: function(deltaPoints, current) {
return this.scaleDeltaPixelsFromPoints( return this.deltaPixelsFromPointsNoRotate(
deltaPoints.rotate(this.getRotation()), deltaPoints.rotate(this.getRotation()),
current); current);
}, },
/** /**
* Scale a delta (translation vector) from pixels coordinates to viewport * Convert a delta (translation vector) from pixels coordinates to viewport
* coordinates. This method does not take rotation into account. * coordinates. This method does not take rotation into account.
* Consider using deltaPointsFromPixels if you need to account for rotation. * Consider using deltaPointsFromPixels if you need to account for rotation.
* @param {OpenSeadragon.Point} deltaPixels - The translation vector to convert. * @param {OpenSeadragon.Point} deltaPixels - The translation vector to convert.
@ -968,7 +968,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location). * defaults to false (target location).
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
scaleDeltaPointsFromPixels: function(deltaPixels, current) { deltaPointsFromPixelsNoRotate: function(deltaPixels, current) {
return deltaPixels.divide( return deltaPixels.divide(
this._containerInnerSize.x * this.getZoom(current) this._containerInnerSize.x * this.getZoom(current)
); );
@ -983,12 +983,12 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
deltaPointsFromPixels: function(deltaPixels, current) { deltaPointsFromPixels: function(deltaPixels, current) {
return this.scaleDeltaPointsFromPixels(deltaPixels, current) return this.deltaPointsFromPixelsNoRotate(deltaPixels, current)
.rotate(-this.getRotation()); .rotate(-this.getRotation());
}, },
/** /**
* Scale viewport coordinates to pixels coordinates. * Convert viewport coordinates to pixels coordinates.
* This method does not take rotation into account. * This method does not take rotation into account.
* Consider using pixelFromPoint if you need to account for rotation. * Consider using pixelFromPoint if you need to account for rotation.
* @param {OpenSeadragon.Point} point the viewport coordinates * @param {OpenSeadragon.Point} point the viewport coordinates
@ -996,8 +996,8 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location). * defaults to false (target location).
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
scalePixelFromPoint: function(point, current) { pixelFromPointNoRotate: function(point, current) {
return this._scalePixelFromPoint(point, this.getBounds(current)); return this._pixelFromPointNoRotate(point, this.getBounds(current));
}, },
/** /**
@ -1012,7 +1012,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
}, },
// private // private
_scalePixelFromPoint: function(point, bounds) { _pixelFromPointNoRotate: function(point, bounds) {
return point.minus( return point.minus(
bounds.getTopLeft() bounds.getTopLeft()
).times( ).times(
@ -1024,13 +1024,13 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
// private // private
_pixelFromPoint: function(point, bounds) { _pixelFromPoint: function(point, bounds) {
return this._scalePixelFromPoint( return this._pixelFromPointNoRotate(
point.rotate(this.getRotation(), this.getCenter(true)), point.rotate(this.getRotation(), this.getCenter(true)),
bounds); bounds);
}, },
/** /**
* Scale pixel coordinates to viewport coordinates. * Convert pixel coordinates to viewport coordinates.
* This method does not take rotation into account. * This method does not take rotation into account.
* Consider using pointFromPixel if you need to account for rotation. * Consider using pointFromPixel if you need to account for rotation.
* @param {OpenSeadragon.Point} pixel Pixel coordinates * @param {OpenSeadragon.Point} pixel Pixel coordinates
@ -1038,7 +1038,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location). * defaults to false (target location).
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
scalePointFromPixel: function(pixel, current) { pointFromPixelNoRotate: function(pixel, current) {
var bounds = this.getBounds( current ); var bounds = this.getBounds( current );
return pixel.minus( return pixel.minus(
new $.Point(this._margins.left, this._margins.top) new $.Point(this._margins.left, this._margins.top)
@ -1057,7 +1057,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @returns {OpenSeadragon.Point} * @returns {OpenSeadragon.Point}
*/ */
pointFromPixel: function(pixel, current) { pointFromPixel: function(pixel, current) {
return this.scalePointFromPixel(pixel, current).rotate( return this.pointFromPixelNoRotate(pixel, current).rotate(
-this.getRotation(), -this.getRotation(),
this.getCenter(true) this.getCenter(true)
); );