Float sidebars left/right and use overflow: hidden.
Fixes a bug on Opera where mouse events propagate to
the map.
//= require menu
//= require sidebar
//= require richtext
-//= require resize
//= require geocoder
//= require querystring
L.OSM.zoom()
.addTo(map);
- $("#small_map").on("resized", function () {
- map.invalidateSize();
- });
-
var params = $("#small_map").data();
var object, bbox;
if (params.type == "changeset") {
L.OSM.zoom()
.addTo(map);
- $("#changeset_list_map").on("resized", function () {
- map.invalidateSize();
- });
-
var group = L.featureGroup().addTo(map);
$("[data-changeset]").each(function () {
L.OSM.zoom()
.addTo(map);
- $("#map").on("resized", function () {
- map.invalidateSize();
- });
-
map.setView(centre, params.zoom);
if ($("#latitude").val() && $("#longitude").val()) {
function maximiseMap() {
$("#content").addClass("maximised");
-
- handleResize();
}
function minimiseMap() {
$("#content").removeClass("maximised");
-
- handleResize();
}
$(document).ready(function () {
- $(window).resize(handleResize);
- handleResize();
-
$("#search_form").submit(function () {
$("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
$("#sidebar_content").load($(this).attr("action"), {
map.noteLayer = new L.LayerGroup({code: 'N'});
map.dataLayer = new L.OSM.DataLayer(null);
- $("#map").on("resized", function () {
+ $("#sidebar").on("opened closed", function () {
map.invalidateSize();
});
L.control.locate({position: 'topright'})
.addTo(map);
- var sidebar = L.OSM.sidebar('#map-ui');
+ var sidebar = L.OSM.sidebar('#map-ui')
+ .addTo(map);
L.OSM.layers({
position: 'topright',
addObjectToMap(params.object, map, { zoom: params.object_zoom });
}
- handleResize();
-
$("body").on("click", "a.set_position", setPositionLink(map));
$("a[data-editor=remote]").click(function(e) {
remoteEditHandler(map.getBounds());
}
- $(window).resize(handleResize);
-
$("#search_form").submit(submitSearch(map));
L.OSM.sidebar = function(selector) {
var control = {},
sidebar = $(selector),
- current = $();
+ current = $(),
+ map;
+
+ control.addTo = function (_) {
+ map = _;
+ return control;
+ };
control.addPane = function(pane) {
pane
};
control.togglePane = function(pane) {
- var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
-
current
.hide()
.trigger('hide');
if (current === pane) {
$(sidebar).hide();
- controlContainer.css({paddingRight: '0'});
current = $();
} else {
$(sidebar).show();
- controlContainer.css({paddingRight: '250px'});
current = pane;
}
current
.show()
.trigger('show');
+
+ map.invalidateSize({pan: false, animate: false});
};
return control;
+++ /dev/null
-function resizeContent() {
- var content = $("#content");
- var leftMargin = parseInt(content.css("left"));
- var rightMargin = parseInt(content.css("right"));
- var bottomMargin = parseInt(content.css("bottom"));
-
- if ($("html").attr("dir") == "ltr") {
- content.width($(window).width() - content.prop("offsetLeft") - rightMargin);
- } else {
- content.width($(window).width() - content.prop("offsetRight") - leftMargin);
- }
-
- content.height($(window).height() - content.prop("offsetTop") - bottomMargin);
-}
-
-function resizeMap() {
- var content_width = $("#content").width();
- var content_height = $("#content").height();
- var sidebar_width = 0;
- var left_border = parseFloat($("#map").css("border-left-width"));
- var right_border = parseFloat($("#map").css("border-right-width"));
- var top_border = parseFloat($("#map").css("border-top-width"));
- var bottom_border = parseFloat($("#map").css("border-bottom-width"));
-
- $("#sidebar:visible").each(function () {
- sidebar_width = sidebar_width + $(this).outerWidth(true);
- });
-
- if ($("html").attr("dir") == "ltr") {
- $("#map").css("left", (sidebar_width) + "px");
- } else {
- $("#map").css("right", (sidebar_width) + "px");
- }
-
- $("#map").width(content_width - sidebar_width - left_border - right_border);
- $("#map").height(content_height - top_border - bottom_border);
- $("#map").trigger("resized");
-}
-
-function handleResize() {
- var brokenContentSize = $("#content").prop("offsetWidth") == 0;
-
- if (brokenContentSize) {
- resizeContent();
- }
-
- resizeMap();
-}
-
-$(document).ready(function () {
- $("#sidebar").on("opened", resizeMap);
- $("#sidebar").on("closed", resizeMap);
-});
L.OSM.zoom()
.addTo(map);
- $("#map").on("resized", function () {
- map.invalidateSize();
- });
-
if (OSM.home) {
map.setView([OSM.home.lat, OSM.home.lon], 12);
} else {
margin: 10px;
}
+/* Rules for the home page */
+
+.site-export #map,
+.site-index #map,
+.site-edit #map {
+ height: 100%;
+ overflow: hidden;
+}
+
#map-ui {
- position: absolute;
display: none;
- right: 0;
+ position: relative;
+ float: right;
width: 250px;
height: 100%;
background: white;
border-left: 1px solid #CCC;
overflow: auto;
-}
-#map-ui {
section {
border-bottom: 1px solid #DDD;
padding: 15px;
#sidebar {
display: none;
- position: absolute;
+ position: relative;
+ float: left;
overflow: auto;
- top: 0px;
- bottom: 0px;
- left: 0px;
border-right: 1px solid $keyline;
width: 33.3333%;
ul {
margin-bottom: $lineheight;
}
-/* Rules for the home page */
-
-.site-export #map,
-.site-index #map {
- position: absolute;
- top: 0px;
- bottom: 0px;
- left: 0px;
- right: 0px;
-}
-
-/* Rules for the edit page */
-
-.site-edit #map {
- position: absolute;
- top: 0px;
- bottom: 0px;
- left: 0px;
- right: 0px;
- overflow: hidden;
-}
-
/* Rules for the changeset list shown by the history tab etc */
#changeset_list {
</div>
</noscript>
-<div id="map">
+<div id="map-ui">
</div>
-<div id="map-ui">
+<div id="map">
</div>
<iframe id="linkloader" style="display: none">