summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-07-07 00:42:40 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-07-09 22:02:49 +0300
commitd634973c8a7f3c4d1b9e222082f02a4e3dcbca14 (patch)
tree15e6b59e0627935c30081d7c43ded4c8986dc503
parent68bed94cd1492e49e2aa191a293ead54b80ac918 (diff)
downloadqtlocation-mapboxgl-d634973c8a7f3c4d1b9e222082f02a4e3dcbca14.tar.gz
[glfw] Use Map::moveBy in GLFWView::onMouseMove
-rw-r--r--platform/glfw/glfw_view.cpp8
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 });