Skip to content

Commit

Permalink
Fixes issue with map layer preferences loading
Browse files Browse the repository at this point in the history
 - Previously it would only work by chance, or if the user had already loaded the map as their visualization.
  • Loading branch information
andrewkfiedler authored and rzwiefel committed Dec 9, 2016
1 parent 1e7aec6 commit 117cefb
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* <http://www.gnu.org/licenses/lgpl.html>.
*
**/
/* global define,setTimeout,require*/
/* global define,require*/
define([
'application',
'underscore',
Expand Down Expand Up @@ -51,9 +51,6 @@ define([
this.layerTabView = new PrefsModalView.LayerTabView({
model: this.model.get('mapLayers')
});
setTimeout(function () {
this.layerTabView.setupMap();
}.bind(this), 100);
},
onRender: function () {
this.layerTabRegion.show(this.layerTabView);
Expand Down Expand Up @@ -84,6 +81,8 @@ define([
layerButtonsRegion: '#layerButtons'
},
initialize: function () {
},
onRender: function () {
var viewLayerModels = [];
this.model.each(function (layerModel) {
var clonedLayerModel = layerModel.clone();
Expand Down Expand Up @@ -126,6 +125,7 @@ define([
childViewOptions: { widgetController: this.widgetController }
});
this.layerButtons = new PrefsModalView.Buttons({ tabView: this });
this.showLayerPickersAndLayerButtons();
}.bind(this));
} else if (maptype.is2d()) {
require(['js/controllers/ol.layerCollection.controller'], function(OpenLayersController){
Expand All @@ -150,19 +150,13 @@ define([
childViewOptions: { widgetController: this.widgetController }
});
this.layerButtons = new PrefsModalView.Buttons({ tabView: this });
this.showLayerPickersAndLayerButtons();
}.bind(this));
}
},
onRender: function () {
showLayerPickersAndLayerButtons: function(){
this.layerPickersRegion.show(this.layerPickers);
this.layerButtonsRegion.show(this.layerButtons);
},
setupMap: function () {
/*
maps are sensitive to DOM state.
cesium must be created sometime after containing DOM is "attached".
openlayers must be created sometime after containing DOM is "visible".
*/
this.widgetController.showMap('layerPickerMap');
},
onDestroy: function () {
Expand Down

0 comments on commit 117cefb

Please sign in to comment.