From 480cb1e3aeca3bdb4c8b5ec6a62ed130075900cb Mon Sep 17 00:00:00 2001 From: sonora Date: Sat, 31 Dec 2016 09:22:27 +0100 Subject: [PATCH] fix zoomCenter for doubleTapZoom --- .../src/net/osmand/plus/views/OsmandMapTileView.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 895640d68e..438d5d0726 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -1029,8 +1029,11 @@ public class OsmandMapTileView implements IMapDownloaderCallback { final QuadPoint cp = initialViewport.getCenterPixelPoint(); // Keep zoom center fixed or flexible - //final LatLon r = calc.getLatLonFromPixel(cp.x + cp.x - initialMultiTouchCenterPoint.x, cp.y + cp.y - initialMultiTouchCenterPoint.y); - final LatLon r = calc.getLatLonFromPixel(cp.x + cp.x - multiTouchSupport.getCenterPoint().x, cp.y + cp.y - multiTouchSupport.getCenterPoint().y); + if (multiTouchSupport.isInZoomMode()) { + LatLon r = calc.getLatLonFromPixel(cp.x + cp.x - multiTouchSupport.getCenterPoint().x, cp.y + cp.y - multiTouchSupport.getCenterPoint().y); + } else { + LatLon r = calc.getLatLonFromPixel(cp.x + cp.x - initialMultiTouchCenterPoint.x, cp.y + cp.y - initialMultiTouchCenterPoint.y); + } setLatLon(r.getLatitude(), r.getLongitude()); int baseZoom = initialViewport.getZoom(); @@ -1055,13 +1058,13 @@ public class OsmandMapTileView implements IMapDownloaderCallback { if (baseZoom > getMaxZoom()) { return false; } - if (baseZoom > getMaxZoom() - 1 && dz > 0) { + if (baseZoom > getMaxZoom() - 1 && dz >= 1) { return false; } if (baseZoom < getMinZoom()) { return false; } - if (baseZoom < getMinZoom() + 1 && dz < 0) { + if (baseZoom < getMinZoom() + 1 && dz <= -1) { return false; } return true;