From 9620272ebb571064527a55b5b04b93b0baa16e9c Mon Sep 17 00:00:00 2001 From: Ventero Date: Fri, 25 Jan 2013 14:17:35 +0100 Subject: [PATCH 1/2] Make sure navigator has non-negative width/height Older versions of IE throw if we try to assign a negative width/height. Fixes #24. --- src/navigator.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index 93729e0b..2fdde096 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -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 )); } @@ -285,4 +288,4 @@ function onCanvasScroll( tracker, position, scroll, shift ) { }; -}( OpenSeadragon )); \ No newline at end of file +}( OpenSeadragon )); From 9b6de523c716a77ef43b98503ef8dd2f89ecadde Mon Sep 17 00:00:00 2001 From: Ventero Date: Fri, 25 Jan 2013 19:53:06 +0100 Subject: [PATCH 2/2] Add TODO comment about magic number --- src/navigator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/navigator.js b/src/navigator.js index 2fdde096..20d77882 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -209,6 +209,7 @@ $.extend( $.Navigator.prototype, $.EventHandler.prototype, $.Viewer.prototype, { style.top = topleft.y + 'px'; style.left = topleft.x + 'px'; + // TODO: What's this magic number mean? 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