src/navigator.js
function( viewport ) {

        var viewerSize,
            newWidth,
            newHeight,
            bounds,
            topleft,
            bottomright;

        viewerSize = $.getElementSize( this.viewer.element );
        if ( this._resizeWithViewer && viewerSize.x && viewerSize.y && !viewerSize.equals( this.oldViewerSize ) ) {
            this.oldViewerSize = viewerSize;

            if ( this.maintainSizeRatio || !this.elementArea) {
                newWidth  = viewerSize.x * this.sizeRatio;
                newHeight = viewerSize.y * this.sizeRatio;
            } 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();
        }

        if (viewport && this.viewport) {
            bounds      = viewport.getBoundsNoRotate(true);
            topleft     = this.viewport.pixelFromPointNoRotate(bounds.getTopLeft(), false);
            bottomright = this.viewport.pixelFromPointNoRotate(bounds.getBottomRight(), false)
                .minus( this.totalBorderWidths );

            //update style for navigator-box
            var style = this.displayRegion.style;
            style.display = this.world.getItemCount() ? 'block' : 'none';

            style.top    = Math.round( topleft.y ) + 'px';
            style.left   = Math.round( topleft.x ) + 'px';

            var width = Math.abs( topleft.x - bottomright.x );
            var height = Math.abs( topleft.y - bottomright.y );
            // make sure width and height are non-negative so IE doesn't throw
            style.width  = Math.round( Math.max( width, 0 ) ) + 'px';
            style.height = Math.round( Math.max( height, 0 ) ) + 'px';
        }

    }
function( viewport ) {

        var viewerSize,
            newWidth,
            newHeight,
            bounds,
            topleft,
            bottomright;

        viewerSize = $.getElementSize( this.viewer.element );
        if ( this._resizeWithViewer && viewerSize.x && viewerSize.y && !viewerSize.equals( this.oldViewerSize ) ) {
            this.oldViewerSize = viewerSize;

            if ( this.maintainSizeRatio || !this.elementArea) {
                newWidth  = viewerSize.x * this.sizeRatio;
                newHeight = viewerSize.y * this.sizeRatio;
            } 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();
        }

        if (viewport && this.viewport) {
            bounds      = viewport.getBoundsNoRotate(true);
            topleft     = this.viewport.pixelFromPointNoRotate(bounds.getTopLeft(), false);
            bottomright = this.viewport.pixelFromPointNoRotate(bounds.getBottomRight(), false)
                .minus( this.totalBorderWidths );

            //update style for navigator-box
            var style = this.displayRegion.style;
            style.display = this.world.getItemCount() ? 'block' : 'none';

            style.top    = Math.round( topleft.y ) + 'px';
            style.left   = Math.round( topleft.x ) + 'px';

            var width = Math.abs( topleft.x - bottomright.x );
            var height = Math.abs( topleft.y - bottomright.y );
            // make sure width and height are non-negative so IE doesn't throw
            style.width  = Math.round( Math.max( width, 0 ) ) + 'px';
            style.height = Math.round( Math.max( height, 0 ) ) + 'px';
        }

    }
function ( viewport ) { var viewerSize , newWidth , newHeight , bounds , topleft , bottomright ; viewerSize = $ . getElementSize ( this . viewer . element ) ; if ( this . _resizeWithViewer && viewerSize . x && viewerSize . y && ! viewerSize . equals ( this . oldViewerSize ) ) { this . oldViewerSize = viewerSize ; if ( this . maintainSizeRatio || ! this . elementArea ) { newWidth = viewerSize . x * this . sizeRatio ; newHeight = viewerSize . y * this . sizeRatio ; } 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 ( ) ; } if ( viewport && this . viewport ) { bounds = viewport . getBoundsNoRotate ( true ) ; topleft = this . viewport . pixelFromPointNoRotate ( bounds . getTopLeft ( ) , false ) ; bottomright = this . viewport . pixelFromPointNoRotate ( bounds . getBottomRight ( ) , false ) . minus ( this . totalBorderWidths ) ; //update style for navigator-box var style = this . displayRegion . style ; style . display = this . world . getItemCount ( ) ? 'block' : 'none' ; style . top = Math . round ( topleft . y ) + 'px' ; style . left = Math . round ( topleft . x ) + 'px' ; var width = Math . abs ( topleft . x - bottomright . x ) ; var height = Math . abs ( topleft . y - bottomright . y ) ; // make sure width and height are non-negative so IE doesn't throw style . width = Math . round ( Math . max ( width , 0 ) ) + 'px' ; style . height = Math . round ( Math . max ( height , 0 ) ) + 'px' ; } }
Used to update the navigator minimap's viewport rectangle when a change in the viewer's viewport occurs.
@function
@param {OpenSeadragon.Viewport} The viewport this navigator is tracking.
Used to update the navigator minimap s viewport rectangle when a change in the viewer s viewport occurs .