diff --git a/src/drawer.js b/src/drawer.js index 0165d1f3..a8db0265 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -398,11 +398,18 @@ function updateViewport( drawer ) { } //Change bounds for rotation - if (degrees === 90 || degrees === 270) { + if (degrees !== 0) { var rotatedBounds = viewportBounds.rotate( degrees ); viewportTL = rotatedBounds.getTopLeft(); viewportBR = rotatedBounds.getBottomRight(); } + else if (degrees !== 0) { + var factor = 0.5 / drawer.viewer.viewport.getZoom(); + viewportTL.x -= factor; + viewportTL.y -= factor; + viewportBR.x += factor; + viewportBR.y += factor; + } //Don't draw if completely outside of the viewport if ( !drawer.wrapHorizontal && diff --git a/src/rectangle.js b/src/rectangle.js index 99172e7d..b518190e 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -194,9 +194,6 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{ newTopLeft; degrees = ( degrees + 360 ) % 360; - if( degrees % 90 !== 0 ) { - throw new Error('Currently only 0, 90, 180, and 270 degrees are supported.'); - } if( degrees === 0 ){ return new $.Rect( diff --git a/src/viewport.js b/src/viewport.js index ccc50a8a..fb64c1df 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -726,9 +726,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ } degrees = ( degrees + 360 ) % 360; - if( degrees % 90 !== 0 ) { - throw new Error('Currently only 0, 90, 180, and 270 degrees are supported.'); - } this.degrees = degrees; this.viewer.forceRedraw();