Skip to content

Commit

Permalink
Merge branch 'develop' into subLayerSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAThomas committed Mar 8, 2016
2 parents 2660f1b + 22123d9 commit 559a165
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions viewer/js/gis/dijit/Basemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ define([
'dijit/DropDownMenu',
'dijit/MenuItem',
'dojo/_base/array',
'dojo/topic',
'dojox/lang/functional',
'dojo/text!./Basemaps/templates/Basemaps.html',
'esri/dijit/BasemapGallery',
'dojo/i18n!./Basemaps/nls/resource',

'dijit/form/DropDownButton',
'xstyle/css!./Basemaps/css/Basemaps.css'
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, DropDownMenu, MenuItem, array, functional, template, BasemapGallery, i18n) {
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, DropDownMenu, MenuItem, array, topic, functional, template, BasemapGallery, i18n) {

// main basemap widget
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
Expand Down Expand Up @@ -72,31 +73,32 @@ define([
id: basemap,
label: this.basemaps[basemap].title,
iconClass: (basemap === this.mapStartBasemap) ? 'selectedIcon' : 'emptyIcon',
onClick: lang.hitch(this, function () {
if (basemap !== this.currentBasemap) {
this.currentBasemap = basemap;
if (this.mode === 'custom') {
this.gallery.select(basemap);
} else {
this.map.setBasemap(basemap);
}
var ch = this.menu.getChildren();
array.forEach(ch, function (c) {
if (c.id === basemap) {
c.set('iconClass', 'selectedIcon');
} else {
c.set('iconClass', 'emptyIcon');
}
});
}
})
onClick: lang.hitch(this, 'updateBasemap', basemap)
});
this.menu.addChild(menuItem);
}
}, this);

topic.subscribe('basemaps/updateBasemap', lang.hitch(this, 'updateBasemap'));
this.dropDownButton.set('dropDown', this.menu);
},
updateBasemap: function (basemap) {
if (basemap !== this.currentBasemap && (array.indexOf(this.basemapsToShow, basemap) !== -1)) {
this.currentBasemap = basemap;
if (this.mode === 'custom') {
this.gallery.select(basemap);
} else {
this.map.setBasemap(basemap);
}
var ch = this.menu.getChildren();
array.forEach(ch, function (c) {
if (c.id === basemap) {
c.set('iconClass', 'selectedIcon');
} else {
c.set('iconClass', 'emptyIcon');
}
});
}
},
startup: function () {
this.inherited(arguments);
if (this.mode === 'custom') {
Expand Down

0 comments on commit 559a165

Please sign in to comment.