var $container = $('<div>')
.attr('class', 'control-layers');
- var link = $('<a>')
+ var button = $('<a>')
.attr('class', 'control-button')
.attr('href', '#')
.attr('title', 'Layers')
var $ui = $('<div>')
.attr('class', 'layers-ui');
- $('<header>')
+ $('<div>')
.attr('class', 'sidebar_heading')
.appendTo($ui)
.append(
$('<h4>')
.text(I18n.t('javascripts.map.layers.header')));
- var baseSection = $('<section>')
- .addClass('base-layers')
+ var baseSection = $('<div>')
+ .attr('class', 'section base-layers')
.appendTo($ui);
- $('<p>')
- .text(I18n.t('javascripts.map.layers.base'))
- .appendTo(baseSection);
-
list = $('<ul>')
.appendTo(baseSection);
function shown() {
miniMap.invalidateSize();
- setView();
- map.on('moveend', setView);
+ setView({animate: false});
+ map.on('moveend', moved);
}
function hide() {
- map.off('moveend', setView);
+ map.off('moveend', moved);
+ }
+
+ function moved() {
+ setView();
}
- function setView() {
- miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0));
+ function setView(options) {
+ miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0), options);
}
});
});
if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
- var overlaySection = $('<section>')
- .addClass('overlay-layers')
+ var overlaySection = $('<div>')
+ .attr('class', 'section overlay-layers')
.appendTo($ui);
$('<p>')
function toggle(e) {
e.stopPropagation();
e.preventDefault();
- options.sidebar.togglePane($ui);
+ options.sidebar.togglePane($ui, button);
}
return $container[0];