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 ); } ); }