From 3a902a7768263c2c9ddfa835b664450ebb057d64 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 5 Nov 2014 16:54:03 -0800 Subject: [PATCH 1/3] Testing overlays --- test/demo/collections/index.html | 4 ++++ test/demo/collections/main.js | 40 ++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/test/demo/collections/index.html b/test/demo/collections/index.html index b6aca4a1..c9fd0b3c 100644 --- a/test/demo/collections/index.html +++ b/test/demo/collections/index.html @@ -19,6 +19,10 @@ background-color: rgba(255, 0, 0, 0.3); } + #overlay1 { + z-index: 10; + } + diff --git a/test/demo/collections/main.js b/test/demo/collections/main.js index e9cde3d3..927b777f 100644 --- a/test/demo/collections/main.js +++ b/test/demo/collections/main.js @@ -40,20 +40,30 @@ } if (testOverlays) { - config.overlays = [ { - px: 13, - py: 120, - width: 124, - height: 132, - id: "overlay" - }, { - px: 400, - py: 500, - width: 400, - height: 400, - id: "fixed-overlay", - placement: "TOP_LEFT" - } ]; + config.overlays = [ + { + id: "overlay1", + x: 0, + y: 0, + width: 0.25, + height: 0.25 + }, + { + px: 13, + py: 120, + width: 124, + height: 132, + id: "overlay" + }, + { + px: 400, + py: 500, + width: 400, + height: 400, + id: "fixed-overlay", + placement: "TOP_LEFT" + } + ]; } if (testMargins) { @@ -86,7 +96,7 @@ } // this.crossTest3(); - this.gridTest(); + this.basicTest(); }, // ---------- From e02a2d55ccf7ce8b2914132f58dd274b3a8d9c99 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 10 Nov 2014 15:53:38 -0800 Subject: [PATCH 2/3] Fixed issue with navigator size when viewer is zero size to start --- src/navigator.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index 2cadc03f..e320fb68 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -309,16 +309,22 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* viewerSize = $.getElementSize( this.viewer.element ); if ( !viewerSize.equals( this.oldViewerSize ) ) { this.oldViewerSize = viewerSize; - if ( this.maintainSizeRatio ) { + + if ( this.maintainSizeRatio || !this.elementArea) { newWidth = viewerSize.x * this.sizeRatio; newHeight = viewerSize.y * this.sizeRatio; - } - else { + } 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(); } From 1159711e264bc84aebe7518c9a3bf603d051e00c Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 10 Nov 2014 16:25:17 -0800 Subject: [PATCH 3/3] Fixed broken navigator unit test --- src/navigator.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index e320fb68..5f1767cc 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -191,7 +191,10 @@ $.Navigator = function( options ){ options.controlOptions ); - if ( options.controlOptions.anchor != $.ControlAnchor.ABSOLUTE && options.controlOptions.anchor != $.ControlAnchor.NONE ) { + this._resizeWithViewer = options.controlOptions.anchor != $.ControlAnchor.ABSOLUTE && + options.controlOptions.anchor != $.ControlAnchor.NONE; + + if ( this._resizeWithViewer ) { if ( options.width && options.height ) { this.element.style.height = typeof ( options.height ) == "number" ? ( options.height + 'px' ) : options.height; this.element.style.width = typeof ( options.width ) == "number" ? ( options.width + 'px' ) : options.width; @@ -307,7 +310,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* bottomright; viewerSize = $.getElementSize( this.viewer.element ); - if ( !viewerSize.equals( this.oldViewerSize ) ) { + if ( this._resizeWithViewer && !viewerSize.equals( this.oldViewerSize ) ) { this.oldViewerSize = viewerSize; if ( this.maintainSizeRatio || !this.elementArea) {