make night ruler appear immediately after day/night change

This commit is contained in:
sonora 2015-02-01 14:45:55 +01:00
parent 4bc6b8d930
commit 9d471a3f8c

View file

@ -30,6 +30,7 @@ public class RulerControl extends MapControls {
Drawable rulerDrawable; Drawable rulerDrawable;
TextPaint rulerTextPaint; TextPaint rulerTextPaint;
final static double screenRulerPercent = 0.25; final static double screenRulerPercent = 0.25;
boolean isNightRemembered = false;
public RulerControl(MapZoomControls zoomControls, MapActivity mapActivity, Handler showUIHandler, float scaleCoefficient) { public RulerControl(MapZoomControls zoomControls, MapActivity mapActivity, Handler showUIHandler, float scaleCoefficient) {
super(mapActivity, showUIHandler, scaleCoefficient); super(mapActivity, showUIHandler, scaleCoefficient);
@ -65,7 +66,7 @@ public class RulerControl extends MapControls {
// update cache // update cache
if (view.isZooming()) { if (view.isZooming()) {
cacheRulerText = null; cacheRulerText = null;
} else if(((tb.getZoom()) != cacheRulerZoom || } else if(((isNight != isNightRemembered) || (tb.getZoom() != cacheRulerZoom) ||
Math.abs(tb.getCenterTileX() - cacheRulerTileX) + Math.abs(tb.getCenterTileY() - cacheRulerTileY) > 1) && Math.abs(tb.getCenterTileX() - cacheRulerTileX) + Math.abs(tb.getCenterTileY() - cacheRulerTileY) > 1) &&
tb.getPixWidth() > 0){ tb.getPixWidth() > 0){
cacheRulerZoom = (tb.getZoom()); cacheRulerZoom = (tb.getZoom());
@ -101,5 +102,6 @@ public class RulerControl extends MapControls {
cacheRulerText.draw(canvas, bounds.left + (bounds.width() - cacheRulerTextLen) / 2, bounds.bottom - 8 * scaleCoefficient, cacheRulerText.draw(canvas, bounds.left + (bounds.width() - cacheRulerTextLen) / 2, bounds.bottom - 8 * scaleCoefficient,
rulerTextPaint, shadowColor); rulerTextPaint, shadowColor);
} }
isNightRemembered = isNight;
} }
} }