diff --git a/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java b/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java index 707db0b662..178c214ef6 100644 --- a/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java +++ b/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java @@ -561,4 +561,16 @@ public class RotatedTileBox { return lat; } + @Override + public String toString() { + return "RotatedTileBox [lat=" + lat + ", lon=" + lon + ", rotate=" + + rotate + ", density=" + density + ", zoom=" + zoom + + ", mapDensity=" + mapDensity + ", zoomAnimation=" + + zoomAnimation + ", zoomFloatPart=" + zoomFloatPart + ", cx=" + + cx + ", cy=" + cy + ", pixWidth=" + pixWidth + ", pixHeight=" + + pixHeight + "]"; + } + + + } diff --git a/OsmAnd/src/net/osmand/plus/views/controls/RulerControl.java b/OsmAnd/src/net/osmand/plus/views/controls/RulerControl.java index 43803c4db6..dc4d1d4e92 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/RulerControl.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/RulerControl.java @@ -58,14 +58,14 @@ public class RulerControl extends MapControls { // update cache if (view.isZooming()) { cacheRulerText = null; - } else if((tb.getZoom()) != cacheRulerZoom || - Math.abs(tb.getCenterTileX() - cacheRulerTileX) + Math.abs(tb.getCenterTileY() - cacheRulerTileY) > 1){ + } else if(((tb.getZoom()) != cacheRulerZoom || + Math.abs(tb.getCenterTileX() - cacheRulerTileX) + Math.abs(tb.getCenterTileY() - cacheRulerTileY) > 1) && + tb.getPixWidth() > 0){ cacheRulerZoom = (tb.getZoom()); cacheRulerTileX = tb.getCenterTileX(); cacheRulerTileY = tb.getCenterTileY(); final double dist = tb.getDistance(0, tb.getPixHeight() / 2, tb.getPixWidth(), tb.getPixHeight() / 2); double pixDensity = tb.getPixWidth() / dist; - double roundedDist = OsmAndFormatter.calculateRoundedDist(dist * screenRulerPercent, view.getApplication()); int cacheRulerDistPix = (int) (pixDensity * roundedDist);