Make sure navigator has non-negative width/height

Older versions of IE throw if we try to assign a negative width/height.

Fixes #24.
This commit is contained in:
Ventero 2013-01-25 14:17:35 +01:00
parent 718082998b
commit 9620272ebb

View File

@ -209,8 +209,11 @@ $.extend( $.Navigator.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
style.top = topleft.y + 'px';
style.left = topleft.x + 'px';
style.width = ( Math.abs( topleft.x - bottomright.x ) - 3 ) + 'px';
style.height = ( Math.abs( topleft.y - bottomright.y ) - 3 ) + 'px';
var width = Math.abs( topleft.x - bottomright.x ) - 3;
var height = Math.abs( topleft.y - bottomright.y ) - 3;
// 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';
}( this.displayRegion.style ));
}