notes[feature.properties.id] = updateMarker(marker, feature);
newNote = null;
- addNoteButton.removeClass("disabled").addClass("geolink");
+ addNoteButton.removeClass("active").addClass("geolink");
}
}
e.preventDefault();
e.stopPropagation();
- if (addNoteButton.hasClass("disabled")) return;
+ if (addNoteButton.hasClass("active")) return;
- addNoteButton.removeClass("geolink").addClass("disabled");
+ addNoteButton.removeClass("geolink").addClass("active");
map.addLayer(noteLayer);
newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
newNote.on("remove", function (e) {
- addNoteButton.removeClass("disabled").addClass("geolink");
+ addNoteButton.removeClass("active").addClass("geolink");
}).on("dragstart", function (e) {
$(newNote).stopTime("removenote");
}).on("dragend", function (e) {
var $container = $('<div>')
.attr('class', 'control-key');
- $('<a>')
+ var button = $('<a>')
.attr('class', 'control-button')
.attr('href', '#')
.attr('title', I18n.t('javascripts.key.tooltip'))
function toggle(e) {
e.stopPropagation();
e.preventDefault();
- options.sidebar.togglePane($ui);
+ options.sidebar.togglePane($ui, button);
}
function update() {
var $container = $('<div>')
.attr('class', 'control-layers');
- var link = $('<a>')
+ var button = $('<a>')
.attr('class', 'control-button')
.attr('href', '#')
.attr('title', 'Layers')
function toggle(e) {
e.stopPropagation();
e.preventDefault();
- options.sidebar.togglePane($ui);
+ options.sidebar.togglePane($ui, button);
}
return $container[0];
var $container = $('<div>')
.attr('class', 'control-share');
- $('<a>')
+ var button = $('<a>')
.attr('class', 'control-button')
.attr('href', '#')
.attr('title', 'Share')
marker.setLatLng(map.getCenter());
update();
- options.sidebar.togglePane($ui);
+ options.sidebar.togglePane($ui, button);
}
function toggleMarker() {
var control = {},
sidebar = $(selector),
current = $(),
+ currentButton = $(),
map;
control.addTo = function (_) {
.appendTo(sidebar);
};
- control.togglePane = function(pane) {
+ control.togglePane = function(pane, button) {
current
.hide()
.trigger('hide');
+ currentButton
+ .removeClass('active');
+
if (current === pane) {
$(sidebar).hide();
- current = $();
+ current = currentButton = $();
} else {
$(sidebar).show();
current = pane;
+ currentButton = button || $();
}
map.invalidateSize({pan: false, animate: false});
current
.show()
.trigger('show');
+
+ currentButton
+ .addClass('active');
};
return control;