diff --git a/src/navigator.js b/src/navigator.js index 9f3923df..7addc5ea 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -108,7 +108,9 @@ $.Navigator = function( options ){ immediateRender: true, blendTime: 0, animationTime: 0, - autoResize: options.autoResize + autoResize: options.autoResize, + // prevent resizing the navigator from adding unwanted space around the image + minZoomImageRatio: 1.0 }); options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio; diff --git a/src/viewer.js b/src/viewer.js index ce7609dd..bca49e5c 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2965,19 +2965,15 @@ function resizeViewportAndRecenter( viewer, containerSize, oldBounds, oldCenter viewport.resize( containerSize, true ); - // We try to remove blanks as much as possible - var worldBounds = viewer.world.getHomeBounds(); - var newWidth = oldBounds.width <= worldBounds.width ? oldBounds.width : worldBounds.width; - var newHeight = oldBounds.height <= worldBounds.height ? - oldBounds.height : worldBounds.height; - var newBounds = new $.Rect( - oldCenter.x - ( newWidth / 2.0 ), - oldCenter.y - ( newHeight / 2.0 ), - newWidth, - newHeight - ); - viewport.fitBounds( newBounds, true ); + oldCenter.x - ( oldBounds.width / 2.0 ), + oldCenter.y - ( oldBounds.height / 2.0 ), + oldBounds.width, + oldBounds.height + ); + + // let the viewport decide if the bounds are too big or too small + viewport.fitBoundsWithConstraints( newBounds, true ); } function drawWorld( viewer ) {