diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-11 13:30:03 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-13 10:28:44 -0700 |
commit | f1c06f8d837b57c1b10677fb5317f0bf20987cf6 (patch) | |
tree | fe64a8ca383b76318f0ee10c778460f5a879b3ad /platform/qt/src/qmapboxgl.cpp | |
parent | a2670336d4387782bb607092f3a06814bdf4eb8d (diff) | |
download | qtlocation-mapboxgl-f1c06f8d837b57c1b10677fb5317f0bf20987cf6.tar.gz |
[all] Remove redundant scale-related camera methods
We don't need to have two different measurement systems for map zoom.
Diffstat (limited to 'platform/qt/src/qmapboxgl.cpp')
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 7cb0541a75..2f5b3d84db 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -565,12 +565,12 @@ void QMapboxGL::setLongitude(double longitude_) */ double QMapboxGL::scale() const { - return d_ptr->mapObj->getScale(); + return std::pow(2.0, d_ptr->mapObj->getZoom()); } void QMapboxGL::setScale(double scale_, const QPointF ¢er) { - d_ptr->mapObj->setScale(scale_, mbgl::ScreenCoordinate { center.x(), center.y() }); + d_ptr->mapObj->setZoom(std::log2(scale_), mbgl::ScreenCoordinate { center.x(), center.y() }); } /*! @@ -1055,7 +1055,7 @@ void QMapboxGL::moveBy(const QPointF &offset) can be used for implementing a pinch gesture. */ void QMapboxGL::scaleBy(double scale_, const QPointF ¢er) { - d_ptr->mapObj->scaleBy(scale_, mbgl::ScreenCoordinate { center.x(), center.y() }); + d_ptr->mapObj->setZoom(d_ptr->mapObj->getZoom() + std::log2(scale_), mbgl::ScreenCoordinate { center.x(), center.y() }); } /*! |