Better code indentation

This commit is contained in:
Frederic Junod
2018-02-14 16:57:30 +01:00
parent 219413f324
commit 577816ca4a
2 changed files with 15 additions and 22 deletions
+7 -12
View File
@@ -98,10 +98,9 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) {
const layers = this.getLayers(); const layers = this.getLayers();
this.layersListenerKeys_.push( this.layersListenerKeys_.push(
listen(layers, CollectionEventType.ADD, listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this),
this.handleLayersAdd_, this), listen(layers, CollectionEventType.REMOVE, this.handleLayersRemove_, this)
listen(layers, CollectionEventType.REMOVE, );
this.handleLayersRemove_, this));
for (const id in this.listenerKeys_) { for (const id in this.listenerKeys_) {
this.listenerKeys_[id].forEach(unlistenByKey); this.listenerKeys_[id].forEach(unlistenByKey);
@@ -112,10 +111,8 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) {
for (let i = 0, ii = layersArray.length; i < ii; i++) { for (let i = 0, ii = layersArray.length; i < ii; i++) {
const layer = layersArray[i]; const layer = layersArray[i];
this.listenerKeys_[getUid(layer).toString()] = [ this.listenerKeys_[getUid(layer).toString()] = [
listen(layer, ObjectEventType.PROPERTYCHANGE, listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),
this.handleLayerChange_, this), listen(layer, EventType.CHANGE, this.handleLayerChange_, this)
listen(layer, EventType.CHANGE,
this.handleLayerChange_, this)
]; ];
} }
@@ -131,10 +128,8 @@ LayerGroup.prototype.handleLayersAdd_ = function(collectionEvent) {
const layer = /** @type {ol.layer.Base} */ (collectionEvent.element); const layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
const key = getUid(layer).toString(); const key = getUid(layer).toString();
this.listenerKeys_[key] = [ this.listenerKeys_[key] = [
listen(layer, ObjectEventType.PROPERTYCHANGE, listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),
this.handleLayerChange_, this), listen(layer, EventType.CHANGE, this.handleLayerChange_, this)
listen(layer, EventType.CHANGE,
this.handleLayerChange_, this)
]; ];
this.changed(); this.changed();
}; };
+8 -10
View File
@@ -178,16 +178,14 @@ Layer.prototype.setMap = function(map) {
this.mapRenderKey_ = null; this.mapRenderKey_ = null;
} }
if (map) { if (map) {
this.mapPrecomposeKey_ = listen( this.mapPrecomposeKey_ = listen(map, RenderEventType.PRECOMPOSE, function(evt) {
map, RenderEventType.PRECOMPOSE, function(evt) { const layerState = this.getLayerState();
const layerState = this.getLayerState(); layerState.managed = false;
layerState.managed = false; layerState.zIndex = Infinity;
layerState.zIndex = Infinity; evt.frameState.layerStatesArray.push(layerState);
evt.frameState.layerStatesArray.push(layerState); evt.frameState.layerStates[getUid(this)] = layerState;
evt.frameState.layerStates[getUid(this)] = layerState; }, this);
}, this); this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);
this.mapRenderKey_ = listen(
this, EventType.CHANGE, map.render, map);
this.changed(); this.changed();
} }
}; };