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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="map_trans_seek_size">120dp</dimen>
<dimen name="map_trans_seek_size">120dp</dimen>
<dimen name="map_widget_text_size">35sp</dimen>
<dimen name="map_top_widget_text_size">33sp</dimen>
<dimen name="map_widget_text_size_small">23sp</dimen>
@ -29,7 +29,7 @@
<dimen name="map_alarm_bottom_margin">140dp</dimen>
<dimen name="map_alarm_bottom_margin_land">81dp</dimen>
<dimen name="map_widget_icon">36dp</dimen>
<dimen name="map_widget_height">48dp</dimen>
<dimen name="map_widget_image">120dp</dimen>
@ -120,13 +120,14 @@
<dimen name="multi_selection_menu_padding_top">20dp</dimen>
<dimen name="multi_selection_menu_padding_bottom">23dp</dimen>
<dimen name="grid_menu_item_width">180dp</dimen>
<dimen name="grid_menu_item_bottom_top_margin">24dp</dimen>
<dimen name="grid_menu_item_sides_margin">60dp</dimen>
<dimen name="grid_menu_item_width">180dp</dimen>
<dimen name="grid_menu_item_bottom_top_margin">24dp</dimen>
<dimen name="grid_menu_item_sides_margin">60dp</dimen>
<dimen name="bottom_sheet_menu_peek_height">450dp</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>

View file

@ -90,6 +90,7 @@
<dimen name="dialog_content_bottom_margin">16dp</dimen>
<dimen name="local_size_height">34dp</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_text_margin">14dp</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) {
int ex = (int) point.x;
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;
for (Recording n : plugin.getAllRecordings()) {
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.RequiresPermission;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import net.osmand.AndroidUtils;
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) {
int x = (int) box.getPixXFromLatLon(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) {
int x = (int) box.getPixXFromLatLon(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())

View file

@ -154,7 +154,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
int ex = (int) point.x;
int ey = (int) point.y;
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;
try {
for (int i = 0; i < objects.size(); i++) {

View file

@ -144,7 +144,8 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
List<TransportStop> objects) {
int ex = (int) point.x;
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;
try {
TreeSet<String> ms = new TreeSet<>();