experiment with moveable zoom centerPoint

This commit is contained in:
sonora 2016-12-30 09:27:46 +01:00
parent d6a6e340b1
commit acb3272e76
2 changed files with 7 additions and 3 deletions

View file

@ -119,6 +119,7 @@ public class MultiTouchSupport {
// }
// return true;
} else if(inZoomMode && actionCode == MotionEvent.ACTION_MOVE){
centerPoint = new PointF((x1 + x2) / 2, (y1 + y2) / 2);
if(angleDefined) {
angleRelative = MapUtils.unifyRotationTo360(angle - angleStarted);
}

View file

@ -1025,14 +1025,17 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
float dx = cp.x - initialMultiTouchCenterPoint.x;
float dy = cp.y - initialMultiTouchCenterPoint.y;
final RotatedTileBox calc = initialViewport.copy();
calc.setLatLonCenter(initialCenterLatLon.getLatitude(), initialCenterLatLon.getLongitude());
//calc.setLatLonCenter(initialCenterLatLon.getLatitude(), initialCenterLatLon.getLongitude());
PointF updatedCenterPoint = multiTouchSupport.getCenterPoint();
calc.setLatLonCenter(initialViewport.getLatLonFromPixel(updatedCenterPoint.x, updatedCenterPoint.y).getLatitude(),
initialViewport.getLatLonFromPixel(updatedCenterPoint.x, updatedCenterPoint.y).getLongitude());
float calcRotate = calc.getRotate() + angle;
calc.setRotate(calcRotate);
calc.setZoomAndAnimation(initialViewport.getZoom(),
dz, initialViewport.getZoomFloatPart());
final LatLon r = calc.getLatLonFromPixel(cp.x + dx, cp.y + dy);
setLatLon(r.getLatitude(), r.getLongitude());
//final LatLon r = calc.getLatLonFromPixel(cp.x + dx, cp.y + dy);
//setLatLon(r.getLatitude(), r.getLongitude());
int baseZoom = initialViewport.getZoom();
while (initialViewport.getZoomFloatPart() + dz > 1 && isZoomingAllowed(baseZoom, dz)) {
dz--;