Compare commits

...

5 Commits

Author SHA1 Message Date
Ian Gilman
09544f795f Changelog for #2246 2022-11-30 14:14:21 -08:00
Ian Gilman
c92fe116c5
Merge pull request #2246 from pearcetm/boundary-constraints-fix
boundary constraint logic fix
2022-11-30 14:12:16 -08:00
Tom
bd8e8a9e7f add line spacing 2022-11-30 16:48:04 -05:00
Tom
5aa5d7ad56 removed extra space 2022-11-29 17:43:14 -05:00
Tom
6d35f6df2c boundary constraint logic fix 2022-11-28 17:45:21 -05:00
2 changed files with 24 additions and 36 deletions

View File

@ -7,7 +7,7 @@ OPENSEADRAGON CHANGELOG
* DEPRECATION: Don't access the viewport's degrees property directly anymore; instead use setRotation and getRotation (#2136 @jonasengelmann) * DEPRECATION: Don't access the viewport's degrees property directly anymore; instead use setRotation and getRotation (#2136 @jonasengelmann)
* New gesture: Double-click and drag to zoom (on by default for touch) (#2225 @HamzaTatheer) * New gesture: Double-click and drag to zoom (on by default for touch) (#2225 @HamzaTatheer)
* You can now provide a pivot point when rotating the viewport (#2233 @ pearcetm) * You can now provide a pivot point when rotating the viewport (#2233 @ pearcetm)
* Improved the constraints that keep the image in the viewer, specifically when zoomed out a lot (#2160 @joedf) * Improved the constraints that keep the image in the viewer, specifically when zoomed out a lot (#2160 @joedf, #2246 @pearcetm)
* You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf) * You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf)
* Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson) * Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson)
* We now delegate tile fetching and caching to the TileSource, to allow for custom tile formats (#2148 @Aiosa) * We now delegate tile fetching and caching to the TileSource, to allow for custom tile formats (#2148 @Aiosa)

View File

@ -530,26 +530,20 @@ $.Viewport.prototype = {
var horizontalThreshold, leftDx, rightDx; var horizontalThreshold, leftDx, rightDx;
if (newBounds.width > this._contentBoundsNoRotate.width) { if (newBounds.width > this._contentBoundsNoRotate.width) {
horizontalThreshold = this.visibilityRatio * this._contentBoundsNoRotate.width; horizontalThreshold = this.visibilityRatio * this._contentBoundsNoRotate.width;
leftDx = this._contentBoundsNoRotate.x - newBounds.x + horizontalThreshold;
rightDx = contentRight - boundsRight - horizontalThreshold;
if (rightDx > 0) {
newBounds.x += rightDx;
} else if (leftDx < 0) {
newBounds.x += leftDx;
}
} else { } else {
horizontalThreshold = this.visibilityRatio * newBounds.width; 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;
}
} }
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) {
@ -561,26 +555,20 @@ $.Viewport.prototype = {
var verticalThreshold, topDy, bottomDy; var verticalThreshold, topDy, bottomDy;
if (newBounds.height > this._contentBoundsNoRotate.height) { if (newBounds.height > this._contentBoundsNoRotate.height) {
verticalThreshold = this.visibilityRatio * this._contentBoundsNoRotate.height; verticalThreshold = this.visibilityRatio * this._contentBoundsNoRotate.height;
topDy = this._contentBoundsNoRotate.y - newBounds.y + verticalThreshold; } else{
bottomDy = contentBottom - boundsBottom - verticalThreshold;
if (bottomDy > 0) {
newBounds.y += bottomDy;
} else if (topDy < 0) {
newBounds.y += topDy;
}
} else {
verticalThreshold = this.visibilityRatio * newBounds.height; 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;
}
} }
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;
}
} }
return newBounds; return newBounds;