Try some slop logic here to better facilitate two finger tap zoom without losing map-linked-to-location

This commit is contained in:
sonora 2017-01-03 17:18:57 +01:00
parent c98c08e070
commit c1edd74e63

View file

@ -1053,7 +1053,15 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
if (!isZoomingAllowed(baseZoom, dz)) { if (!isZoomingAllowed(baseZoom, dz)) {
dz = Math.signum(dz); dz = Math.signum(dz);
} }
zoomToAnimate(baseZoom, dz, !doubleTapScaleDetector.isInZoomMode());
//Try some slop logic here to better facilitate two finger tap zoom without losing map-linked-to-location
boolean loseLocationLinkSlop = (multiTouchSupport.getCenterPoint().x - initialMultiTouchCenterPoint.x)
* (multiTouchSupport.getCenterPoint().x - initialMultiTouchCenterPoint.x)
+ (multiTouchSupport.getCenterPoint().y - initialMultiTouchCenterPoint.y)
* (multiTouchSupport.getCenterPoint().y - initialMultiTouchCenterPoint.y))
< 64;
zoomToAnimate(baseZoom, dz, !(doubleTapScaleDetector.isInZoomMode() || loseLocationLinkSlop);
rotateToAnimate(calcRotate); rotateToAnimate(calcRotate);
} }