Fix scale pressed area size

This commit is contained in:
Dima-1 2020-05-21 14:04:14 +03:00
parent 18dd2356e0
commit aa9b656d45
6 changed files with 22 additions and 12 deletions

View file

@ -128,5 +128,6 @@
<dimen name="side_of_the_world_button_size">54dp</dimen> <dimen name="side_of_the_world_button_size">54dp</dimen>
<dimen name="toolbar_height">64dp</dimen> <dimen name="toolbar_height">64dp</dimen>
<dimen name="poi_icon_size">24dp</dimen>
</resources> </resources>

View file

@ -90,6 +90,7 @@
<dimen name="dialog_content_bottom_margin">16dp</dimen> <dimen name="dialog_content_bottom_margin">16dp</dimen>
<dimen name="local_size_height">34dp</dimen> <dimen name="local_size_height">34dp</dimen>
<dimen name="standard_icon_size">24dp</dimen> <dimen name="standard_icon_size">24dp</dimen>
<dimen name="poi_icon_size">16dp</dimen>
<dimen name="gpx_small_icon_margin">3dp</dimen> <dimen name="gpx_small_icon_margin">3dp</dimen>
<dimen name="gpx_small_text_margin">14dp</dimen> <dimen name="gpx_small_text_margin">14dp</dimen>
<dimen name="gpx_text_top_margin">6dp</dimen> <dimen name="gpx_text_top_margin">6dp</dimen>

View file

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

View file

@ -21,7 +21,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresPermission; import androidx.annotation.RequiresPermission;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject; import net.osmand.CallbackWithObject;
@ -223,15 +222,21 @@ public class ContextMenuLayer extends OsmandMapLayer {
} }
} }
} }
float scale = 1f;
if (!pressedLatLonSmall.isEmpty() || !pressedLatLonFull.isEmpty()) {
scale = activity.getMyApplication().getSettings().TEXT_SCALE.get();
}
for (LatLon latLon : pressedLatLonSmall) { for (LatLon latLon : pressedLatLonSmall) {
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
canvas.drawBitmap(pressedBitmapSmall, x - pressedBitmapSmall.getWidth() / 2, y - pressedBitmapSmall.getHeight() / 2, paint); Rect destRect = getIconDestinationRect(x, y, pressedBitmapSmall.getWidth(), pressedBitmapSmall.getHeight(), scale);
canvas.drawBitmap(pressedBitmapSmall, null, destRect, paint);
} }
for (LatLon latLon : pressedLatLonFull) { for (LatLon latLon : pressedLatLonFull) {
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
canvas.drawBitmap(pressedBitmap, x - pressedBitmap.getWidth() / 2, y - pressedBitmap.getHeight() / 2, paint); Rect destRect = getIconDestinationRect(x, y, pressedBitmap.getWidth(), pressedBitmap.getHeight(), scale);
canvas.drawBitmap(pressedBitmap, null, destRect, paint);
} }
if (mapQuickActionLayer != null && mapQuickActionLayer.isInMovingMarkerMode()) if (mapQuickActionLayer != null && mapQuickActionLayer.isInMovingMarkerMode())

View file

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

View file

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