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.
*/
viewportToDrawerRectangle: function(rectangle) {
var topLeft = this.viewport.scalePixelFromPoint(rectangle.getTopLeft(), true);
var size = this.viewport.scaleDeltaPixelsFromPoints(rectangle.getSize(), true);
var topLeft = this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(), true);
var size = this.viewport.deltaPixelsFromPointsNoRotate(rectangle.getSize(), true);
return new $.Rect(
topLeft.x * $.pixelDensityRatio,

View File

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

View File

@ -652,7 +652,7 @@ function updateViewport( tiledImage ) {
haveDrawn = false,
currentTime = $.now(),
viewportBounds = tiledImage.viewport.getBoundsWithMargins( true ),
zeroRatioC = tiledImage.viewport.scaleDeltaPixelsFromPoints(
zeroRatioC = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( 0 ),
true
).x * tiledImage._scaleSpring.current.value,
@ -733,7 +733,7 @@ function updateViewport( tiledImage ) {
drawLevel = false;
//Avoid calculations for draw if we have already drawn this
renderPixelRatioC = tiledImage.viewport.scaleDeltaPixelsFromPoints(
renderPixelRatioC = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( level ),
true
).x * tiledImage._scaleSpring.current.value;
@ -747,12 +747,12 @@ function updateViewport( tiledImage ) {
}
//Perform calculations for draw if we haven't drawn this
renderPixelRatioT = tiledImage.viewport.scaleDeltaPixelsFromPoints(
renderPixelRatioT = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio( level ),
false
).x * tiledImage._scaleSpring.current.value;
zeroRatioT = tiledImage.viewport.scaleDeltaPixelsFromPoints(
zeroRatioT = tiledImage.viewport.deltaPixelsFromPointsNoRotate(
tiledImage.source.getPixelRatio(
Math.max(
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.y *= tiledImage._scaleSpring.current.value;
var positionC = viewport.scalePixelFromPoint(boundsTL, true),
positionT = viewport.scalePixelFromPoint(boundsTL, false),
sizeC = viewport.scaleDeltaPixelsFromPoints(boundsSize, true),
sizeT = viewport.scaleDeltaPixelsFromPoints(boundsSize, false),
var positionC = viewport.pixelFromPointNoRotate(boundsTL, true),
positionT = viewport.pixelFromPointNoRotate(boundsTL, false),
sizeC = viewport.deltaPixelsFromPointsNoRotate(boundsSize, true),
sizeT = viewport.deltaPixelsFromPointsNoRotate(boundsSize, false),
tileCenter = positionT.plus( sizeT.divide( 2 ) ),
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.
* Consider using deltaPixelsFromPoints if you need to account for rotation.
* @param {OpenSeadragon.Point} deltaPoints - The translation vector to convert.
@ -939,7 +939,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location).
* @returns {OpenSeadragon.Point}
*/
scaleDeltaPixelsFromPoints: function(deltaPoints, current) {
deltaPixelsFromPointsNoRotate: function(deltaPoints, current) {
return deltaPoints.times(
this._containerInnerSize.x * this.getZoom(current)
);
@ -954,13 +954,13 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @returns {OpenSeadragon.Point}
*/
deltaPixelsFromPoints: function(deltaPoints, current) {
return this.scaleDeltaPixelsFromPoints(
return this.deltaPixelsFromPointsNoRotate(
deltaPoints.rotate(this.getRotation()),
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.
* Consider using deltaPointsFromPixels if you need to account for rotation.
* @param {OpenSeadragon.Point} deltaPixels - The translation vector to convert.
@ -968,7 +968,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location).
* @returns {OpenSeadragon.Point}
*/
scaleDeltaPointsFromPixels: function(deltaPixels, current) {
deltaPointsFromPixelsNoRotate: function(deltaPixels, current) {
return deltaPixels.divide(
this._containerInnerSize.x * this.getZoom(current)
);
@ -983,12 +983,12 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @returns {OpenSeadragon.Point}
*/
deltaPointsFromPixels: function(deltaPixels, current) {
return this.scaleDeltaPointsFromPixels(deltaPixels, current)
return this.deltaPointsFromPixelsNoRotate(deltaPixels, current)
.rotate(-this.getRotation());
},
/**
* Scale viewport coordinates to pixels coordinates.
* Convert viewport coordinates to pixels coordinates.
* This method does not take rotation into account.
* Consider using pixelFromPoint if you need to account for rotation.
* @param {OpenSeadragon.Point} point the viewport coordinates
@ -996,8 +996,8 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location).
* @returns {OpenSeadragon.Point}
*/
scalePixelFromPoint: function(point, current) {
return this._scalePixelFromPoint(point, this.getBounds(current));
pixelFromPointNoRotate: function(point, current) {
return this._pixelFromPointNoRotate(point, this.getBounds(current));
},
/**
@ -1012,7 +1012,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
},
// private
_scalePixelFromPoint: function(point, bounds) {
_pixelFromPointNoRotate: function(point, bounds) {
return point.minus(
bounds.getTopLeft()
).times(
@ -1024,13 +1024,13 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
// private
_pixelFromPoint: function(point, bounds) {
return this._scalePixelFromPoint(
return this._pixelFromPointNoRotate(
point.rotate(this.getRotation(), this.getCenter(true)),
bounds);
},
/**
* Scale pixel coordinates to viewport coordinates.
* Convert pixel coordinates to viewport coordinates.
* This method does not take rotation into account.
* Consider using pointFromPixel if you need to account for rotation.
* @param {OpenSeadragon.Point} pixel Pixel coordinates
@ -1038,7 +1038,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* defaults to false (target location).
* @returns {OpenSeadragon.Point}
*/
scalePointFromPixel: function(pixel, current) {
pointFromPixelNoRotate: function(pixel, current) {
var bounds = this.getBounds( current );
return pixel.minus(
new $.Point(this._margins.left, this._margins.top)
@ -1057,7 +1057,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @returns {OpenSeadragon.Point}
*/
pointFromPixel: function(pixel, current) {
return this.scalePointFromPixel(pixel, current).rotate(
return this.pointFromPixelNoRotate(pixel, current).rotate(
-this.getRotation(),
this.getCenter(true)
);