Fix precision error

This commit is contained in:
max-klaus 2020-02-01 21:11:59 +03:00
parent aac1742afb
commit 782b3a6236
2 changed files with 4 additions and 6 deletions

View file

@ -172,11 +172,11 @@ public class MapUtils {
}
public static double get31LongitudeX(int tileX) {
return MapUtils.getLongitudeFromTile(21, tileX / 1024f);
return MapUtils.getLongitudeFromTile(21, tileX / 1024.0);
}
public static double get31LatitudeY(int tileY) {
return MapUtils.getLatitudeFromTile(21, tileY / 1024f);
return MapUtils.getLatitudeFromTile(21, tileY / 1024.0);
}

View file

@ -677,10 +677,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
RenderingContext rc = maps.getVisibleRenderingContext();
RenderedObject[] renderedObjects = null;
if (rc != null && rc.zoom == tileBox.getZoom()) {
double lat = MapUtils.get31LatitudeY((int) (rc.topY * rc.tileDivisor));
double lon = MapUtils.get31LongitudeX((int) (rc.leftX * rc.tileDivisor));
float x = tileBox.getPixXFromLatLon(lat, lon);
float y = tileBox.getPixYFromLatLon(lat, lon);
float x = tileBox.getPixXFrom31((int) (rc.leftX * rc.tileDivisor), (int) (rc.topY * rc.tileDivisor));
float y = tileBox.getPixYFrom31((int) (rc.leftX * rc.tileDivisor), (int) (rc.topY * rc.tileDivisor));
renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y));
}
if (renderedObjects != null) {