Fix scale pressed area size

This commit is contained in:
Dima-1 2020-05-21 15:53:59 +03:00
parent aa9b656d45
commit aa05635f6e
6 changed files with 14 additions and 10 deletions

View file

@ -203,8 +203,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements
public void getRecordingsFromPoint(PointF point, RotatedTileBox tileBox, List<? super Recording> am) {
int ex = (int) point.x;
int ey = (int) point.y;
float textScale = activity.getMyApplication().getSettings().TEXT_SCALE.get();
int compare = getRadiusPoi(tileBox) * (int) textScale;
int compare = getScaledTouchRadius(activity.getMyApplication(), getRadiusPoi(tileBox));
int radius = compare * 3 / 2;
for (Recording n : plugin.getAllRecordings()) {
int x = (int) tileBox.getPixXFromLatLon(n.getLatitude(), n.getLongitude());

View file

@ -216,7 +216,7 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.
}
private void getFavoriteFromPoint(RotatedTileBox tb, PointF point, List<? super FavouritePoint> res) {
int r = getDefaultRadiusPoi(tb);
int r = getScaledTouchRadius(view.getApplication(), getDefaultRadiusPoi(tb));
int ex = (int) point.x;
int ey = (int) point.y;
for (FavouritePoint n : favorites.getFavouritePoints()) {

View file

@ -580,7 +580,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
}
public void getWptFromPoint(RotatedTileBox tb, PointF point, List<? super WptPt> res) {
int r = getDefaultRadiusPoi(tb);
int r = getScaledTouchRadius(view.getApplication(), getDefaultRadiusPoi(tb));
int ex = (int) point.x;
int ey = (int) point.y;
List<SelectedGpxFile> selectedGpxFiles = new ArrayList<>(selectedGpxHelper.getSelectedGPXFiles());

View file

@ -637,6 +637,14 @@ public abstract class OsmandMapLayer {
return rect;
}
public int getScaledTouchRadius(OsmandApplication app, int radiusPoi) {
float textScale = app.getSettings().TEXT_SCALE.get();
if (textScale < 1.0f) {
textScale = 1.0f;
}
return (int) textScale * radiusPoi;
}
public abstract class MapLayerData<T> {
public int ZOOM_THRESHOLD = 1;
public RotatedTileBox queriedBox;

View file

@ -153,10 +153,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
if (objects != null) {
int ex = (int) point.x;
int ey = (int) point.y;
final int rp = getRadiusPoi(tb);
float textScale = app.getSettings().TEXT_SCALE.get();
int compare = rp * (int) textScale;
int radius = rp * 3 / 2;
int compare = getScaledTouchRadius(view.getApplication(), getRadiusPoi(tb));
int radius = compare * 3 / 2;
try {
for (int i = 0; i < objects.size(); i++) {
Amenity n = objects.get(i);

View file

@ -144,8 +144,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
List<TransportStop> objects) {
int ex = (int) point.x;
int ey = (int) point.y;
float textScale = mapActivity.getMyApplication().getSettings().TEXT_SCALE.get();
final int rp = getRadiusPoi(tb) * (int) textScale;
final int rp = getScaledTouchRadius(mapActivity.getMyApplication(), getRadiusPoi(tb));
int radius = rp * 3 / 2;
try {
TreeSet<String> ms = new TreeSet<>();