mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-18 00:09:53 +00:00
OeffiMapView: Prevent map from extremely zooming into a single point.
This commit is contained in:
parent
9a900a07bb
commit
aa9856ae3f
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue