mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Fixed issue with navigator size when viewer is zero size to start
This commit is contained in:
parent
9ebdaee326
commit
e02a2d55cc
@ -309,16 +309,22 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
viewerSize = $.getElementSize( this.viewer.element );
|
||||
if ( !viewerSize.equals( this.oldViewerSize ) ) {
|
||||
this.oldViewerSize = viewerSize;
|
||||
if ( this.maintainSizeRatio ) {
|
||||
|
||||
if ( this.maintainSizeRatio || !this.elementArea) {
|
||||
newWidth = viewerSize.x * this.sizeRatio;
|
||||
newHeight = viewerSize.y * this.sizeRatio;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
newWidth = Math.sqrt(this.elementArea * (viewerSize.x / viewerSize.y));
|
||||
newHeight = this.elementArea / newWidth;
|
||||
}
|
||||
|
||||
this.element.style.width = Math.round( newWidth ) + 'px';
|
||||
this.element.style.height = Math.round( newHeight ) + 'px';
|
||||
|
||||
if (!this.elementArea) {
|
||||
this.elementArea = newWidth * newHeight;
|
||||
}
|
||||
|
||||
this.updateSize();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user