Fix finding point to move

This commit is contained in:
PavelRatushny 2017-08-10 11:07:45 +03:00
parent 5251bb1bb7
commit 2b7f5f6f4e

View file

@ -133,7 +133,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
double pressedPointLat = tileBox.getLatFromPixel(point.x, point.y);
double pressedPointLon = tileBox.getLonFromPixel(point.x, point.y);
getPointToMove(pressedPointLat, pressedPointLon);
if (movePointPos != -1) {
if (pointBeforeMovement != null && movePointPos != -1) {
enterMovingPointMode();
if (inMeasurementMode && inMovePointMode && enterMovePointModeListener != null) {
enterMovePointModeListener.onEnterMovePointMode();
@ -148,9 +148,11 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
}
private void getPointToMove(double lat, double lon) {
RotatedTileBox tb = view.getCurrentRotatedTileBox();
double lowestDistance = Double.MAX_VALUE;
for (int i = 0; i < measurementPoints.size(); i++) {
WptPt pt = measurementPoints.get(i);
if (tb.containsLatLon(pt.getLatitude(), pt.getLongitude())) {
double latDiff = pt.getLatitude() - lat;
double lonDiff = pt.getLongitude() - lon;
double distToPoint = Math.sqrt(Math.pow(latDiff, 2) + Math.pow(lonDiff, 2));
@ -161,6 +163,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
}
}
}
}
@Override
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {