Skip to content

Commit

Permalink
Avoid redundant ImageryLayerCollection events.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Mar 12, 2013
1 parent 7669b36 commit 75bbfe5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Source/Scene/ImageryLayerCollection.js
Expand Up @@ -296,6 +296,9 @@ define([
*/
ImageryLayerCollection.prototype.raiseToTop = function(layer) {
var index = getLayerIndex(this._layers, layer);
if (index === this._layers.length - 1) {
return;
}
this._layers.splice(index, 1);
this._layers.push(layer);

Expand All @@ -316,6 +319,9 @@ define([
*/
ImageryLayerCollection.prototype.lowerToBottom = function(layer) {
var index = getLayerIndex(this._layers, layer);
if (index === 0) {
return;
}
this._layers.splice(index, 1);
this._layers.splice(0, 0, layer);

Expand Down Expand Up @@ -383,11 +389,13 @@ define([
}

if (layer.show !== layer._show) {
layer._show = layer.show;
if (typeof layersShownOrHidden === 'undefined') {
layersShownOrHidden = [];
if (typeof layer._show !== 'undefined') {
if (typeof layersShownOrHidden === 'undefined') {
layersShownOrHidden = [];
}
layersShownOrHidden.push(layer);
}
layersShownOrHidden.push(layer);
layer._show = layer.show;
}
}

Expand Down

0 comments on commit 75bbfe5

Please sign in to comment.