mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Support other rotation angles.
This commit is contained in:
parent
873135b492
commit
3353bd5f69
@ -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 &&
|
||||||
|
@ -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(
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user