Rename viewport.contentAspectX to viewport.contentAspectRatio. Remove viewport.contentAspectY.

This commit is contained in:
Antoine Vandecreme 2016-02-13 11:20:34 -05:00
parent 4634d90715
commit 925ba8a78e

View File

@ -184,8 +184,7 @@ $.Viewport.prototype = {
this._contentBounds = bounds.rotate(this.degrees).getBoundingBox(); this._contentBounds = bounds.rotate(this.degrees).getBoundingBox();
this.contentSize = this._contentBounds.getSize().times(contentFactor); this.contentSize = this._contentBounds.getSize().times(contentFactor);
this.contentAspectX = this.contentSize.x / this.contentSize.y; this._contentAspectRatio = this.contentSize.x / this.contentSize.y;
this.contentAspectY = this.contentSize.y / this.contentSize.x;
if (this.viewer) { if (this.viewer) {
/** /**
@ -222,7 +221,7 @@ $.Viewport.prototype = {
return this.defaultZoomLevel; return this.defaultZoomLevel;
} }
var aspectFactor = this.contentAspectX / this.getAspectRatio(); var aspectFactor = this._contentAspectRatio / this.getAspectRatio();
var output; var output;
if (this.homeFillsViewer) { // fill the viewer and clip the image if (this.homeFillsViewer) { // fill the viewer and clip the image
output = aspectFactor >= 1 ? aspectFactor : 1; output = aspectFactor >= 1 ? aspectFactor : 1;
@ -1074,8 +1073,9 @@ $.Viewport.prototype = {
// private // private
_viewportToImageDelta: function( viewerX, viewerY ) { _viewportToImageDelta: function( viewerX, viewerY ) {
var scale = this._contentBounds.width; var scale = this._contentBounds.width;
return new $.Point(viewerX * (this.contentSize.x / scale), return new $.Point(
viewerY * ((this.contentSize.y * this.contentAspectX) / scale)); viewerX * this.contentSize.x / scale,
viewerY * this.contentSize.x / scale);
}, },
/** /**
@ -1105,8 +1105,9 @@ $.Viewport.prototype = {
// private // private
_imageToViewportDelta: function( imageX, imageY ) { _imageToViewportDelta: function( imageX, imageY ) {
var scale = this._contentBounds.width; var scale = this._contentBounds.width;
return new $.Point((imageX / this.contentSize.x) * scale, return new $.Point(
(imageY / this.contentSize.y / this.contentAspectX) * scale); imageX / this.contentSize.x * scale,
imageY / this.contentSize.x * scale);
}, },
/** /**