Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Map Controls view with calls to log the event
Composer.module('MapBarModule.Controls', function (Controls, App, Backbone, Marionette, $, _) {
//Controls item view
Controls.View = Backbone.Marionette.ItemView.extend({
model: Controls.Model,
template: 'mapbar/controls/controls_view',
className: 'mapbar-controls',
events: {
"click .type": "_changeBasemap"
},
_changeBasemap: function(e) {
var id = e.target.id;
//toggle some classes to update the UI
this.$el.find('.type').removeClass('selected-type');
this.$el.find('#'+id).addClass('selected-type');
//log that the user did this action
App.logUiEvent(id, 'map-basemap');
//event bus call
App.execute('map:new:basemap', id.replace(/basemap-/, ''));
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.