Write the marker name only on one line

This commit is contained in:
alex 2017-11-09 16:53:12 +02:00
parent 29d50cb2b3
commit 561814bd0c

View file

@ -240,6 +240,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
textAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.paint.setStyle(Paint.Style.FILL); textAttrs.paint.setStyle(Paint.Style.FILL);
boolean drawMarkerName = map.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 1;
int locX; int locX;
int locY; int locY;
if (map.getMapViewTrackingUtilities().isMapLinkedToLocation() if (map.getMapViewTrackingUtilities().isMapLinkedToLocation()
@ -273,7 +275,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
float dist = (float) MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(), marker.getLatitude(), marker.getLongitude()); float dist = (float) MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(), marker.getLatitude(), marker.getLongitude());
String distSt = OsmAndFormatter.getFormattedDistance(dist, view.getApplication()); String distSt = OsmAndFormatter.getFormattedDistance(dist, view.getApplication());
String text = distSt + "" + marker.getName(map); String text = distSt + (drawMarkerName ? "" + marker.getName(map) : "");
Rect bounds = new Rect(); Rect bounds = new Rect();
textAttrs.paint.getTextBounds(text, 0, text.length(), bounds); textAttrs.paint.getTextBounds(text, 0, text.length(), bounds);
float hOffset = pm.getLength() / 2 - bounds.width() / 2; float hOffset = pm.getLength() / 2 - bounds.width() / 2;