Delete zero writing in the multiTouchEndTime field

This commit is contained in:
Alexander Sytnyk 2017-06-29 12:03:50 +03:00
parent 84a8086a36
commit 143297bee9
2 changed files with 13 additions and 10 deletions

View file

@ -167,6 +167,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
private float secondTouchPointY;
private boolean multiTouch;
private long multiTouchEndTime;
private boolean wasZoomInMultiTouch;
public OsmandMapTileView(MapActivity activity, int w, int h) {
this.activity = activity;
@ -336,8 +337,12 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
return multiTouchEndTime;
}
public void setMultiTouchEndTime(long multiTouchEndTime) {
this.multiTouchEndTime = multiTouchEndTime;
public boolean isWasZoomInMultiTouch() {
return wasZoomInMultiTouch;
}
public void setWasZoomInMultiTouch(boolean wasZoomInMultiTouch) {
this.wasZoomInMultiTouch = wasZoomInMultiTouch;
}
public void setIntZoom(int zoom) {
@ -1048,6 +1053,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
secondTouchPointX = x2;
secondTouchPointY = y2;
multiTouch = true;
wasZoomInMultiTouch = false;
}
}
@ -1064,9 +1070,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
public void onActionPointerUp() {
multiTouch = false;
if (isZooming()) {
multiTouchEndTime = 0;
wasZoomInMultiTouch = true;
} else {
multiTouchEndTime = System.currentTimeMillis();
wasZoomInMultiTouch = false;
}
}

View file

@ -44,7 +44,6 @@ public class RulerControlLayer extends OsmandMapLayer {
private QuadPoint cacheCenter;
private int cacheIntZoom;
private double cacheFractionalZoom;
private double cacheTileX;
private double cacheTileY;
private long cacheMultiTouchEndTime;
@ -118,16 +117,13 @@ public class RulerControlLayer extends OsmandMapLayer {
final QuadPoint center = tb.getCenterPixelPoint();
final RulerMode mode = app.getSettings().RULER_MODE.get();
if (cacheIntZoom != view.getZoom() || cacheFractionalZoom != view.getZoomFractionalPart()) {
cacheIntZoom = view.getZoom();
cacheFractionalZoom = view.getZoomFractionalPart();
view.setMultiTouchEndTime(0);
cacheMultiTouchEndTime = 0;
if (view.isMultiTouch() && view.isZooming()) {
view.setWasZoomInMultiTouch(true);
} else if (cacheMultiTouchEndTime != view.getMultiTouchEndTime()) {
cacheMultiTouchEndTime = view.getMultiTouchEndTime();
refreshMapDelayed();
}
showTwoFingersDistance = !view.isZooming() && view.isMultiTouch() || System.currentTimeMillis() - cacheMultiTouchEndTime < DELAY;
showTwoFingersDistance = !view.isWasZoomInMultiTouch() && !view.isZooming() && (view.isMultiTouch() || System.currentTimeMillis() - cacheMultiTouchEndTime < DELAY);
if (showTwoFingersDistance) {
float x1 = view.getFirstTouchPointX();
float y1 = view.getFirstTouchPointY();