summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-12 17:17:12 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-12 17:18:28 +0200
commitc644de386e1da61dabaa6a03e2280746fa9d34c4 (patch)
tree07edb7c4176be934ed1220de976803ae665247b6
parent4b97d91734baaadaecfaaf0813dab93348cbd44e (diff)
downloadqtlocation-mapboxgl-upstream/map-api-cleanup.tar.gz
-rw-r--r--platform/glfw/glfw_view.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index 9179113139..ab3fede220 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -266,13 +266,17 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
double distance = routeProgress * routeDistance;
auto point = ruler.along(lineString, distance);
auto latLng = routeMap->getLatLng();
- routeMap->setLatLng({ point.y, point.x });
double bearing = ruler.bearing({ latLng.longitude(), latLng.latitude() }, point);
double easing = bearing - routeMap->getBearing();
easing += easing > 180.0 ? -360.0 : easing < -180 ? 360.0 : 0;
- routeMap->setBearing(routeMap->getBearing() + (easing / 20));
- routeMap->setPitch(60.0);
- routeMap->setZoom(18.0);
+
+ mbgl::CameraOptions cameraOptions;
+ cameraOptions.center = { point.y, point.x };
+ cameraOptions.zoom = 18.0;
+ cameraOptions.pitch = 60.0;
+ cameraOptions.angle = routeMap->getBearing() + (easing / 20);
+
+ routeMap->jumpTo(cameraOptions);
};
view->animateRouteCallback(view->map);
} break;