Compare commits

..

No commits in common. "c20b2bbab9799fb49f7e6770b9687fbbadc78647" and "e8adefbe6e88cd46401ed96516ff94a2ffb17306" have entirely different histories.

2 changed files with 18 additions and 46 deletions

View File

@ -3,8 +3,6 @@ OPENSEADRAGON CHANGELOG
3.2.0: (in progress) 3.2.0: (in progress)
* Improved the constraints that keep the image in the viewer, specifically when zoomed out a lot (#2160 @joedf)
3.1.0: 3.1.0:
* Added subPixelRoundingForTransparency Viewer option to address seams that can appear in semi-transparent images (#2075 @TanukiSharp) * Added subPixelRoundingForTransparency Viewer option to address seams that can appear in semi-transparent images (#2075 @TanukiSharp)

View File

@ -500,62 +500,36 @@ $.Viewport.prototype = {
if (this.wrapHorizontal) { if (this.wrapHorizontal) {
//do nothing //do nothing
} else { } else {
var horizontalThreshold = this.visibilityRatio * newBounds.width;
var boundsRight = newBounds.x + newBounds.width; var boundsRight = newBounds.x + newBounds.width;
var contentRight = this._contentBoundsNoRotate.x + this._contentBoundsNoRotate.width; var contentRight = this._contentBoundsNoRotate.x + this._contentBoundsNoRotate.width;
var leftDx = this._contentBoundsNoRotate.x - boundsRight + horizontalThreshold;
var rightDx = contentRight - newBounds.x - horizontalThreshold;
var horizontalThreshold, leftDx, rightDx; if (horizontalThreshold > this._contentBoundsNoRotate.width) {
if (newBounds.width > this._contentBoundsNoRotate.width) { newBounds.x += (leftDx + rightDx) / 2;
horizontalThreshold = this.visibilityRatio * this._contentBoundsNoRotate.width; } else if (rightDx < 0) {
leftDx = this._contentBoundsNoRotate.x - newBounds.x + horizontalThreshold; newBounds.x += rightDx;
rightDx = contentRight - boundsRight - horizontalThreshold; } else if (leftDx > 0) {
newBounds.x += leftDx;
if (rightDx > 0) {
newBounds.x += rightDx;
} else if (leftDx < 0) {
newBounds.x += leftDx;
}
} else {
horizontalThreshold = this.visibilityRatio * newBounds.width;
leftDx = this._contentBoundsNoRotate.x - boundsRight + horizontalThreshold;
rightDx = contentRight - newBounds.x - horizontalThreshold;
if (horizontalThreshold > this._contentBoundsNoRotate.width) {
newBounds.x += (leftDx + rightDx) / 2;
} else if (rightDx < 0) {
newBounds.x += rightDx;
} else if (leftDx > 0) {
newBounds.x += leftDx;
}
} }
} }
if (this.wrapVertical) { if (this.wrapVertical) {
//do nothing //do nothing
} else { } else {
var verticalThreshold = this.visibilityRatio * newBounds.height;
var boundsBottom = newBounds.y + newBounds.height; var boundsBottom = newBounds.y + newBounds.height;
var contentBottom = this._contentBoundsNoRotate.y + this._contentBoundsNoRotate.height; var contentBottom = this._contentBoundsNoRotate.y + this._contentBoundsNoRotate.height;
var topDy = this._contentBoundsNoRotate.y - boundsBottom + verticalThreshold;
var bottomDy = contentBottom - newBounds.y - verticalThreshold;
var verticalThreshold, topDy, bottomDy; if (verticalThreshold > this._contentBoundsNoRotate.height) {
if (newBounds.height > this._contentBoundsNoRotate.height) { newBounds.y += (topDy + bottomDy) / 2;
verticalThreshold = this.visibilityRatio * this._contentBoundsNoRotate.height; } else if (bottomDy < 0) {
topDy = this._contentBoundsNoRotate.y - newBounds.y + verticalThreshold; newBounds.y += bottomDy;
bottomDy = contentBottom - boundsBottom - verticalThreshold; } else if (topDy > 0) {
newBounds.y += topDy;
if (bottomDy > 0) {
newBounds.y += bottomDy;
} else if (topDy < 0) {
newBounds.y += topDy;
}
} else {
verticalThreshold = this.visibilityRatio * newBounds.height;
topDy = this._contentBoundsNoRotate.y - boundsBottom + verticalThreshold;
bottomDy = contentBottom - newBounds.y - verticalThreshold;
if (verticalThreshold > this._contentBoundsNoRotate.height) {
newBounds.y += (topDy + bottomDy) / 2;
} else if (bottomDy < 0) {
newBounds.y += bottomDy;
} else if (topDy > 0) {
newBounds.y += topDy;
}
} }
} }