From b66dd7bed026d19d3f388a99bc35227cdad4f972 Mon Sep 17 00:00:00 2001 From: Ventero Date: Thu, 30 May 2013 02:49:45 +0200 Subject: [PATCH] Don't load the tile source again when creating a navigator. Previously, when showNavigator was set to true when creating the viewer, the navigator would unnecessarily load and parse the tile source, even though a fully parsed object already exists. --- src/viewer.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index a44717ee..233c245e 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1147,7 +1147,10 @@ function openTileSource( viewer, source ) { sizeRatio: _this.navigatorSizeRatio, height: _this.navigatorHeight, width: _this.navigatorWidth, - tileSources: _this.tileSources, + // 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, @@ -1212,10 +1215,6 @@ function openTileSource( viewer, source ) { } VIEWERS[ _this.hash ] = _this; - if( _this.navigator ){ - _this.navigator.open( source ); - } - _this.raiseEvent( 'open', { source: source, viewer: _this } ); return _this;