diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-11-12 17:17:12 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-11-12 17:18:28 +0200 |
commit | c644de386e1da61dabaa6a03e2280746fa9d34c4 (patch) | |
tree | 07edb7c4176be934ed1220de976803ae665247b6 /platform/glfw | |
parent | 4b97d91734baaadaecfaaf0813dab93348cbd44e (diff) | |
download | qtlocation-mapboxgl-c644de386e1da61dabaa6a03e2280746fa9d34c4.tar.gz |
glfw-jumptoupstream/map-api-cleanup
Diffstat (limited to 'platform/glfw')
-rw-r--r-- | platform/glfw/glfw_view.cpp | 12 |
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; |