Better gesture handling.

This commit is contained in:
GaidamakUA 2016-06-07 16:46:41 +03:00
parent f54fa3bc62
commit 8b24f5684b
3 changed files with 23 additions and 23 deletions

View file

@ -139,12 +139,12 @@ public class DoubleTapScaleDetector {
}
public interface DoubleTapZoomListener {
public void onZoomStarted(PointF centerPoint);
void onZoomStarted(PointF centerPoint);
public void onZooming(double relativeToStart);
void onZooming(double relativeToStart);
public void onZoomEnded(double relativeToStart);
void onZoomEnded(double relativeToStart);
public void onGestureInit(float x1, float y1, float x2, float y2);
void onGestureInit(float x1, float y1, float x2, float y2);
}
}

View file

@ -830,17 +830,13 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
animatedDraggingThread.stopAnimating();
}
for (int i = layers.size() - 1; i >= 0; i--) {
if (layers.get(i).onTouchEvent(event, getCurrentRotatedTileBox())) {
return true;
layers.get(i).onTouchEvent(event, getCurrentRotatedTileBox());
}
}
if (!multiTouchSupport.onTouchEvent(event)) {
/* return */
final boolean isMultiTouch = multiTouchSupport.onTouchEvent(event);
doubleTapScaleDetector.onTouchEvent(event);
if (!doubleTapScaleDetector.isInZoomMode()) {
if (!isMultiTouch && !doubleTapScaleDetector.isInZoomMode()) {
gestureDetector.onTouchEvent(event);
}
}
return true;
}
@ -1100,6 +1096,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
@Override
public boolean onDoubleTap(MotionEvent e) {
LOG.debug("onDoubleTap getZoom()");
if (!doubleTapScaleDetector.isInZoomMode()) {
if (isZoomingAllowed(getZoom(), 1.1f)) {
final RotatedTileBox tb = getCurrentRotatedTileBox();
final double lat = tb.getLatFromPixel(e.getX(), e.getY());
@ -1107,6 +1104,9 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
getAnimatedDraggingThread().startMoving(lat, lon, getZoom() + 1, true);
}
return true;
} else {
return false;
}
}
}

View file

@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.1.2'
}
}