Fix ruler
This commit is contained in:
parent
5651c54ca4
commit
1568f9b598
2 changed files with 15 additions and 3 deletions
|
@ -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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue