Skip to content

Commit

Permalink
Merge pull request #337 from gberaudo/fix_layer_ordering
Browse files Browse the repository at this point in the history
Fix layer ordering
  • Loading branch information
gberaudo committed Apr 5, 2016
2 parents 1c1c484 + d1ce172 commit effde3b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/rastersynchronizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,18 @@ olcs.RasterSynchronizer.prototype.createSingleLayerCounterparts =
olcs.RasterSynchronizer.prototype.orderLayers = function() {
var layers = [];
var zIndices = {};
var fifo = [this.mapLayerGroup];
var queue = [this.mapLayerGroup];

while (fifo.length > 0) {
var olLayer = fifo.splice(0, 1)[0];
while (queue.length > 0) {
var olLayer = queue.splice(0, 1)[0];
layers.push(olLayer);
zIndices[goog.getUid(olLayer)] = olLayer.getZIndex();

if (olLayer instanceof ol.layer.Group) {
var sublayers = olLayer.getLayers();
if (goog.isDef(sublayers)) {
sublayers.forEach(function(el) {
fifo.push(el);
});
if (sublayers) {
// Prepend queue with sublayers in order
queue.unshift.apply(queue, sublayers.getArray());
}
}
}
Expand Down

0 comments on commit effde3b

Please sign in to comment.