Merge pull request #3764 from darina/navigator-test-fix

Navigator test fixed.
This commit is contained in:
Roman Kuznetsov 2016-07-12 13:53:00 +03:00 committed by GitHub
commit e74c53a802
2 changed files with 6 additions and 6 deletions

View file

@ -195,10 +195,9 @@ void MyPositionController::CorrectScalePoint(m2::PointD & pt1, m2::PointD & pt2)
{
if (IsModeChangeViewport())
{
m2::PointD const offset = (pt2 - pt1) / 2.0;
m2::PointD const center = GetRotationPixelCenter();
pt1 = center - offset;
pt2 = center + offset;
m2::PointD const oldPt1(pt1);
pt1 = GetRotationPixelCenter();
pt2 = pt2 - oldPt1 + pt1;
}
}

View file

@ -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 + oldPt2) / 2.0;
m2::PointD const center3d = oldPt1;
m2::PointD const center2d = screen.P3dtoP(center3d);
m2::PointD const centerG = screen.PtoG(center2d);
m2::PointD const offset = center2d - center3d;
@ -188,7 +188,8 @@ bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2,
doRotateScreen);
ScreenBase tmp = screen;
tmp.SetGtoPMatrix(newM);
tmp.MatchGandP3d(centerG, center3d);
if (tmp.isPerspective())
tmp.MatchGandP3d(centerG, center3d);
if (!skipMinScaleAndBordersCheck && !CheckMinScale(tmp))
return false;