mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Replace error for non right-angle rotations in Rect.rotate.
This commit is contained in:
parent
1c63c96f04
commit
ea80c05a05
@ -404,6 +404,7 @@ function updateViewport( drawer ) {
|
|||||||
viewportBR = rotatedBounds.getBottomRight();
|
viewportBR = rotatedBounds.getBottomRight();
|
||||||
}
|
}
|
||||||
else if (degrees !== 0) {
|
else if (degrees !== 0) {
|
||||||
|
// This is just an approximation.
|
||||||
var orthBounds = viewportBounds.rotate(90);
|
var orthBounds = viewportBounds.rotate(90);
|
||||||
viewportBounds.x -= orthBounds.width / 2;
|
viewportBounds.x -= orthBounds.width / 2;
|
||||||
viewportBounds.y -= orthBounds.height / 2;
|
viewportBounds.y -= orthBounds.height / 2;
|
||||||
|
@ -241,7 +241,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
|||||||
(this.container.clientHeight === 0 ? 1 : this.container.clientHeight)
|
(this.container.clientHeight === 0 ? 1 : this.container.clientHeight)
|
||||||
);
|
);
|
||||||
if ( !containerSize.equals( this.oldContainerSize ) ) {
|
if ( !containerSize.equals( this.oldContainerSize ) ) {
|
||||||
var oldBounds = this.viewport.getBounds().rotate(this.viewport.degrees);
|
var oldBounds = this.viewport.getBounds();
|
||||||
var oldCenter = this.viewport.getCenter();
|
var oldCenter = this.viewport.getCenter();
|
||||||
this.viewport.resize( containerSize, true );
|
this.viewport.resize( containerSize, true );
|
||||||
var imageHeight = 1 / this.source.aspectRatio;
|
var imageHeight = 1 / this.source.aspectRatio;
|
||||||
|
@ -195,6 +195,11 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.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.');
|
||||||
|
}
|
||||||
|
|
||||||
if( degrees === 0 ){
|
if( degrees === 0 ){
|
||||||
return new $.Rect(
|
return new $.Rect(
|
||||||
this.x,
|
this.x,
|
||||||
|
Loading…
Reference in New Issue
Block a user