Fix precision error
This commit is contained in:
parent
aac1742afb
commit
782b3a6236
2 changed files with 4 additions and 6 deletions
|
@ -172,11 +172,11 @@ public class MapUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double get31LongitudeX(int tileX) {
|
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) {
|
public static double get31LatitudeY(int tileY) {
|
||||||
return MapUtils.getLatitudeFromTile(21, tileY / 1024f);
|
return MapUtils.getLatitudeFromTile(21, tileY / 1024.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -677,10 +677,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
RenderingContext rc = maps.getVisibleRenderingContext();
|
RenderingContext rc = maps.getVisibleRenderingContext();
|
||||||
RenderedObject[] renderedObjects = null;
|
RenderedObject[] renderedObjects = null;
|
||||||
if (rc != null && rc.zoom == tileBox.getZoom()) {
|
if (rc != null && rc.zoom == tileBox.getZoom()) {
|
||||||
double lat = MapUtils.get31LatitudeY((int) (rc.topY * rc.tileDivisor));
|
float x = tileBox.getPixXFrom31((int) (rc.leftX * rc.tileDivisor), (int) (rc.topY * rc.tileDivisor));
|
||||||
double lon = MapUtils.get31LongitudeX((int) (rc.leftX * rc.tileDivisor));
|
float y = tileBox.getPixYFrom31((int) (rc.leftX * rc.tileDivisor), (int) (rc.topY * rc.tileDivisor));
|
||||||
float x = tileBox.getPixXFromLatLon(lat, lon);
|
|
||||||
float y = tileBox.getPixYFromLatLon(lat, lon);
|
|
||||||
renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y));
|
renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y));
|
||||||
}
|
}
|
||||||
if (renderedObjects != null) {
|
if (renderedObjects != null) {
|
||||||
|
|
Loading…
Reference in a new issue