From a7cec524ebb6b940ec4b48ddc4bdf8fba6a262ce Mon Sep 17 00:00:00 2001 From: houseofyin Date: Sat, 23 Mar 2013 21:11:30 -0400 Subject: [PATCH] Tweaked the border handling a bit --- src/navigator.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index 8d5f3f99..9e15e310 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -57,6 +57,7 @@ $.Navigator = function( options ){ this.viewerDimensionsInPoints = viewer.viewport.deltaPointsFromPixels($.getElementSize( viewer.element)); this.borderWidth = 2; + this.borderWidths = new $.Point(this.borderWidth, this.borderWidth); (function( style, borderWidth ){ style.margin = '0px'; @@ -232,8 +233,8 @@ $.extend( $.Navigator.prototype, $.EventHandler.prototype, $.Viewer.prototype, { if( viewport && this.viewport ){ bounds = viewport.getBounds( true ); - topleft = this.viewport.pixelFromPoint( bounds.getTopLeft() ); - bottomright = this.viewport.pixelFromPoint( bounds.getBottomRight() ); + topleft = this.viewport.pixelFromPoint( bounds.getTopLeft()); + bottomright = this.viewport.pixelFromPoint( bounds.getBottomRight()).minus(this.borderWidths).minus(this.borderWidths); //update style for navigator-box (function(style, borderWidth){ @@ -241,8 +242,8 @@ $.extend( $.Navigator.prototype, $.EventHandler.prototype, $.Viewer.prototype, { style.top = topleft.y + 'px'; style.left = topleft.x + 'px'; - var width = Math.abs( topleft.x - bottomright.x ) - (borderWidth); - var height = Math.abs( topleft.y - bottomright.y ) - (borderWidth); + 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.max( width, 0 ) + 'px'; style.height = Math.max( height, 0 ) + 'px';