diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-07-07 00:42:40 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-07-09 22:02:49 +0300 |
commit | d634973c8a7f3c4d1b9e222082f02a4e3dcbca14 (patch) | |
tree | 15e6b59e0627935c30081d7c43ded4c8986dc503 | |
parent | 68bed94cd1492e49e2aa191a293ead54b80ac918 (diff) | |
download | qtlocation-mapboxgl-d634973c8a7f3c4d1b9e222082f02a4e3dcbca14.tar.gz |
[glfw] Use Map::moveBy in GLFWView::onMouseMove
-rw-r--r-- | platform/glfw/glfw_view.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index b499956b96..60cc20e05a 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -497,12 +497,10 @@ void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modi void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) { auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); if (view->tracking) { - double dx = x - view->lastX; - double dy = y - view->lastY; + const double dx = x - view->lastX; + const double dy = y - view->lastY; if (dx || dy) { - view->map->setLatLng( - view->map->latLngForPixel(mbgl::ScreenCoordinate(x - dx, y - dy)), - mbgl::ScreenCoordinate(x, y)); + view->map->moveBy(mbgl::ScreenCoordinate { dx, dy }); } } else if (view->rotating) { view->map->rotateBy({ view->lastX, view->lastY }, { x, y }); |