From aa9856ae3f9d8465a292526e957d35b20b87b73e Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Fri, 9 Nov 2018 14:07:27 +0100 Subject: [PATCH] OeffiMapView: Prevent map from extremely zooming into a single point. --- oeffi/src/de/schildbach/oeffi/OeffiMapView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oeffi/src/de/schildbach/oeffi/OeffiMapView.java b/oeffi/src/de/schildbach/oeffi/OeffiMapView.java index 0c3fe1c..78e9cee 100644 --- a/oeffi/src/de/schildbach/oeffi/OeffiMapView.java +++ b/oeffi/src/de/schildbach/oeffi/OeffiMapView.java @@ -18,6 +18,7 @@ package de.schildbach.oeffi; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -592,7 +593,11 @@ public class OeffiMapView extends MapView { } if (!points.isEmpty()) { - final BoundingBox boundingBox = BoundingBox.fromGeoPoints(points); + final BoundingBox boundingBox; + if (points.size() == 1) + boundingBox = BoundingBox.fromGeoPoints(Arrays.asList(points.get(0), getMapCenter())); + else + boundingBox = BoundingBox.fromGeoPoints(points); zoomToBoundingBox(boundingBox.increaseByScale(1.3f), !firstLocation); firstLocation = false;