]> git.openstreetmap.org Git - rails.git/commitdiff
Handle large bounding box changesets better
authorTom Hughes <tom@compton.nu>
Fri, 13 May 2011 16:27:12 +0000 (17:27 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 13 May 2011 16:27:12 +0000 (17:27 +0100)
If the bounding box of a changeset is much larger than the map then
there seem to be problems with OL not rendering the feature correctly
so reduce the highlight to just be the extent of the map plus a small
margin in that case.

app/views/changeset/_map.html.erb

index 6d7aa96c04fafbafcf95f971e7373b16eb524391..5f5f4aa5d158fbec6239feb233f2491eb09bf697 100644 (file)
     var feature = vectors.getFeatureByFid(id);
     var bounds = feature.geometry.getBounds();
 
-    if ( highlight ) vectors.removeFeatures(highlight);
+    if (bounds.containsBounds(map.getExtent())) {
+      bounds = map.getExtent().scale(1.1);
+    }
+
+    if (highlight) vectors.removeFeatures(highlight);
 
     highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
       strokeWidth: 2,