]> git.openstreetmap.org Git - rails.git/commitdiff
keys change depending on zoom level; force 210px sidebar width for keys
authorRichard Fairhurst <richard@systemed.net>
Sun, 28 Oct 2007 15:22:15 +0000 (15:22 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sun, 28 Oct 2007 15:22:15 +0000 (15:22 +0000)
app/views/site/_key.rhtml
app/views/site/_sidebar.rhtml

index 2d8f1bc762b7f7053c6ad14245be82a55424c6f7..54ec829096681301d7ff41242e990d43d14be82c 100644 (file)
@@ -5,8 +5,12 @@
 <script type="text/javascript">
 <!--
   function showKey() {
-    updateSidebar("Map key", "<p><img src='images/keymapnik11.png' /></p>");
-    openSidebar();
+       var zoomlevel=map.getZoom();
+       if      (zoomlevel<7 ) { var imgname='keymapnik6.png'; }
+       else if (zoomlevel<12) { var imgname='keymapnik'+zoomlevel+'.png'; }
+       else                   { var imgname='keymapnik12.png'; }
+    updateSidebar("Map key", "<p><img src='images/"+imgname+"' /></p>");
+    openSidebar("210px");
   }
 // -->
 </script>
index ae557f90d98bf435ea56ebda3601434d4e000336..8cf1ce62c114f5828101147a3902a78999bcc21b 100644 (file)
@@ -12,6 +12,8 @@
 <script type="text/javascript">
 <!--
   function openSidebar() {
+       if (arguments.length) { $("sidebar").style.width = arguments[0]; }
+                        else { $("sidebar").style.width = "30%"; }
     $("sidebar").style.display = "block";
     <%= onopen %>
   }