From e99c126a85c2b61fa9819ec0f401fc772bedce8e Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 17 Jun 2013 11:51:02 -0700 Subject: [PATCH] Navigator now updates properly when reopening a viewer Before, if you closed a viewer and then opened a new tilesource into it, the navigator would still have the old tilesource. This patch fixes that. --- src/viewer.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 03538992..3265b027 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1153,22 +1153,25 @@ function openTileSource( viewer, source ) { }); //Instantiate a navigator if configured - if ( _this.showNavigator && ! _this.navigator && !_this.collectionMode ){ - _this.navigator = new $.Navigator({ - id: _this.navigatorId, - position: _this.navigatorPosition, - sizeRatio: _this.navigatorSizeRatio, - height: _this.navigatorHeight, - width: _this.navigatorWidth, - // By passing the fully parsed source here, the navigator doesn't - // have to load it again. Additionally, we don't have to call - // navigator.open, as it's implicitly called in the ctor. - tileSources: source, - tileHost: _this.tileHost, - prefixUrl: _this.prefixUrl, - overlays: _this.overlays, - viewer: _this - }); + if ( _this.showNavigator && !_this.collectionMode ){ + // Note: By passing the fully parsed source, the navigator doesn't + // have to load it again. + if ( _this.navigator ) { + _this.navigator.open( source ); + } else { + _this.navigator = new $.Navigator({ + id: _this.navigatorId, + position: _this.navigatorPosition, + sizeRatio: _this.navigatorSizeRatio, + height: _this.navigatorHeight, + width: _this.navigatorWidth, + tileSources: source, + tileHost: _this.tileHost, + prefixUrl: _this.prefixUrl, + overlays: _this.overlays, + viewer: _this + }); + } } //Instantiate a referencestrip if configured