From 695df873ca9c8193ffdd0865df02e45ab2bc9e2d Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Thu, 30 Jan 2014 16:59:51 -0500 Subject: [PATCH] Update the source when the base layer change. --- src/viewer.js | 3 ++- test/demo/layers.html | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index bd5ff377..d978fbed 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1155,8 +1155,9 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, if ( THIS[ this.hash ].sequenced ) { throw new Error( "Cannot reassign base level when in sequence mode." ); } - // We need to re-assign the base drawer + // We need to re-assign the base drawer and the source this.drawer = level === 0 ? drawer : this.getLayerAtLevel( level ); + this.source = this.drawer.source; } this.drawers.splice( oldLevel, 1 ); this.drawers.splice( level, 0, drawer ); diff --git a/test/demo/layers.html b/test/demo/layers.html index 87467480..c4777f55 100644 --- a/test/demo/layers.html +++ b/test/demo/layers.html @@ -146,13 +146,13 @@ } function updateOrder() { - var nbLayers = viewer.getNumberOfLayers(); + var nbLayers = viewer.getLayersCount(); if ( nbLayers < 2 ) { return; } $.each( $( "#used select option" ), function( index, value ) { var layer = value.innerHTML; - viewer.setLayerLevel( layers[layer], nbLayers - index ); + viewer.setLayerLevel( layers[layer], nbLayers -1 - index ); } ); }