Support other rotation angles.

This commit is contained in:
Dominik Picheta 2014-08-13 15:52:20 +01:00
parent 873135b492
commit 3353bd5f69
3 changed files with 8 additions and 7 deletions

View File

@ -398,11 +398,18 @@ function updateViewport( drawer ) {
} }
//Change bounds for rotation //Change bounds for rotation
if (degrees === 90 || degrees === 270) { if (degrees !== 0) {
var rotatedBounds = viewportBounds.rotate( degrees ); var rotatedBounds = viewportBounds.rotate( degrees );
viewportTL = rotatedBounds.getTopLeft(); viewportTL = rotatedBounds.getTopLeft();
viewportBR = rotatedBounds.getBottomRight(); 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 //Don't draw if completely outside of the viewport
if ( !drawer.wrapHorizontal && if ( !drawer.wrapHorizontal &&

View File

@ -194,9 +194,6 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
newTopLeft; newTopLeft;
degrees = ( degrees + 360 ) % 360; degrees = ( degrees + 360 ) % 360;
if( degrees % 90 !== 0 ) {
throw new Error('Currently only 0, 90, 180, and 270 degrees are supported.');
}
if( degrees === 0 ){ if( degrees === 0 ){
return new $.Rect( return new $.Rect(

View File

@ -726,9 +726,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
} }
degrees = ( degrees + 360 ) % 360; 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.degrees = degrees;
this.viewer.forceRedraw(); this.viewer.forceRedraw();