]> git.openstreetmap.org Git - rails.git/commitdiff
for items which don't actually have a geometry, just zoomToMaxExtent.
authorChristopher Schmidt <crschmidt@crschmidt.net>
Sun, 20 Apr 2008 15:36:37 +0000 (15:36 +0000)
committerChristopher Schmidt <crschmidt@crschmidt.net>
Sun, 20 Apr 2008 15:36:37 +0000 (15:36 +0000)
app/views/browse/_map.rhtml

index 466c9b6cc488729605bcb4fb7ff09047def892ad..a0fcc06aae471aab057a6c73e89451058e23b275 100644 (file)
         for (var i = 1; i < this.features.length; i++) {
             extent.extend(this.features[i].geometry.getBounds());
         }
         for (var i = 1; i < this.features.length; i++) {
             extent.extend(this.features[i].geometry.getBounds());
         }
-        this.map.zoomToExtent(extent);
-        var center = getMapCenter();
+        if (extent) {
+               this.map.zoomToExtent(extent);
+        } else {
+               this.map.zoomToMaxExtent();
+       }
+       var center = getMapCenter();
         $("larger_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
         $("larger_map").innerHTML = "View Larger Map";
     } else {
         $("larger_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
         $("larger_map").innerHTML = "View Larger Map";
     } else {