+
+ function setBounds(bounds) {
+ var precision = zoomPrecision(map.getZoom());
+ $("#minlon").val(bounds.getWest().toFixed(precision));
+ $("#minlat").val(bounds.getSouth().toFixed(precision));
+ $("#maxlon").val(bounds.getEast().toFixed(precision));
+ $("#maxlat").val(bounds.getNorth().toFixed(precision));
+ }
+
+ function validateControls() {
+ $("#export_osm_too_large").toggle(getBounds().getSize() > OSM.MAX_REQUEST_AREA);
+ }
+
+ page.pushstate = page.popstate = function(path) {
+ $("#export_tab").addClass("current");
+ $("#sidebar").removeClass("minimized");
+ map.invalidateSize();
+ $("#sidebar_content").load(path, page.load);
+ };
+
+ page.load = function() {
+ $("#sidebar").removeClass("minimized");
+ map
+ .addLayer(locationFilter)
+ .on("moveend", update);
+
+ $("#maxlat, #minlon, #maxlon, #minlat").change(boundsChanged);
+ $("#drag_box").click(enableFilter);
+ $("#sidebar_content .close").on("click", page.minimizeSidebar);
+
+ update();
+ };
+
+ page.unload = function() {
+ map
+ .removeLayer(locationFilter)
+ .off("moveend", update);
+
+ $("#export_tab").removeClass("current");
+ };
+
+ return page;
+};