From 53e20809e1de5527162c50a4cabeec5f0adcb765 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Mon, 21 Aug 2017 18:48:40 +0300 Subject: [PATCH] Fix finding bounds only once --- .../osmand/plus/measurementtool/MeasurementToolLayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index ad58e056e0..546a86c830 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -327,10 +327,10 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL int previousDrawnLocY = -1; for (int i = 0; i < measurementPoints.size(); i++) { WptPt pt = measurementPoints.get(i); - if (tb.containsLatLon(pt.lat, pt.lon)) { + int locX = tb.getPixXFromLonNoRot(pt.lon); + int locY = tb.getPixYFromLatNoRot(pt.lat); + if (locX >= 0 && locX <= tb.getPixWidth() && locY >= 0 && locY <= tb.getPixHeight()) { if (!(inMovePointMode && i == selectedPointPos)) { - int locX = tb.getPixXFromLonNoRot(pt.lon); - int locY = tb.getPixYFromLatNoRot(pt.lat); boolean xOverlap = false; boolean yOverlap = false; if (previousDrawnLocX != -1 && previousDrawnLocY != -1) {