When adding gpx, only rezoom map if gpx not in viewport (closes #2297)

This commit is contained in:
Bryan Housel
2014-07-25 11:59:33 -04:00
parent 7cd7ec8af6
commit 4d40e8f50b
+5 -2
View File
@@ -149,8 +149,11 @@ iD.Background = function(context) {
background.zoomToGpxLayer = function() {
if (background.hasGpxLayer()) {
context.map()
.extent(d3.geo.bounds(gpxLayer.geojson()));
var gpx = d3.geo.bounds(gpxLayer.geojson());
if (!context.map().extent().intersects(gpx)) {
context.map().extent(gpx);
}
}
};