From d6b837eb5d189c8943bfe2ced7286a95d74e4940 Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Mon, 11 Jul 2016 17:10:25 +0300 Subject: [PATCH] Zoom on two touches fixed. --- drape_frontend/my_position_controller.cpp | 7 ++++--- drape_frontend/navigator.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drape_frontend/my_position_controller.cpp b/drape_frontend/my_position_controller.cpp index 0feaf86a64..0fdc0cd458 100644 --- a/drape_frontend/my_position_controller.cpp +++ b/drape_frontend/my_position_controller.cpp @@ -195,9 +195,10 @@ void MyPositionController::CorrectScalePoint(m2::PointD & pt1, m2::PointD & pt2) { if (IsModeChangeViewport()) { - m2::PointD const oldPt1(pt1); - pt1 = GetRotationPixelCenter(); - pt2 = pt2 - oldPt1 + pt1; + m2::PointD const offset = (pt2 - pt1) / 2.0; + m2::PointD const center = GetRotationPixelCenter(); + pt1 = center - offset; + pt2 = center + offset; } } diff --git a/drape_frontend/navigator.cpp b/drape_frontend/navigator.cpp index 08e7685980..37461729dc 100644 --- a/drape_frontend/navigator.cpp +++ b/drape_frontend/navigator.cpp @@ -178,7 +178,7 @@ bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2, bool skipMinScaleAndBordersCheck, bool doRotateScreen, ScreenBase & screen) { - m2::PointD const center3d = oldPt1; + m2::PointD const center3d = (oldPt1 + oldPt2) / 2.0; m2::PointD const center2d = screen.P3dtoP(center3d); m2::PointD const centerG = screen.PtoG(center2d); m2::PointD const offset = center2d - center3d;