mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-16 14:53:14 +03:00
Fixed window resize for navigator with multi-image
This commit is contained in:
parent
7078826be1
commit
211127b87b
@ -272,23 +272,10 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
|||||||
(this.container.clientWidth === 0 ? 1 : this.container.clientWidth),
|
(this.container.clientWidth === 0 ? 1 : this.container.clientWidth),
|
||||||
(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();
|
|
||||||
var oldCenter = this.viewport.getCenter();
|
|
||||||
this.viewport.resize( containerSize, true );
|
this.viewport.resize( containerSize, true );
|
||||||
var worldBounds = this.world.getHomeBounds();
|
this.viewport.goHome(true);
|
||||||
var aspectRatio = worldBounds.width / worldBounds.height;
|
|
||||||
var imageHeight = 1 / aspectRatio;
|
|
||||||
var newWidth = oldBounds.width <= 1 ? oldBounds.width : 1;
|
|
||||||
var newHeight = oldBounds.height <= imageHeight ?
|
|
||||||
oldBounds.height : imageHeight;
|
|
||||||
var newBounds = new $.Rect(
|
|
||||||
oldCenter.x - ( newWidth / 2.0 ),
|
|
||||||
oldCenter.y - ( newHeight / 2.0 ),
|
|
||||||
newWidth,
|
|
||||||
newHeight
|
|
||||||
);
|
|
||||||
this.viewport.fitBounds( newBounds, true );
|
|
||||||
this.oldContainerSize = containerSize;
|
this.oldContainerSize = containerSize;
|
||||||
this.drawer.update();
|
this.drawer.update();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
var testInitialOpen = true;
|
var testInitialOpen = true;
|
||||||
var testOverlays = false;
|
var testOverlays = false;
|
||||||
var testMargins = false;
|
var testMargins = false;
|
||||||
var testNavigator = false;
|
var testNavigator = true;
|
||||||
var margins;
|
var margins;
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user