diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-02-28 12:27:12 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-04 14:45:32 +0200 |
commit | 73ac3c784fe755650dc631e2e722a47890981248 (patch) | |
tree | a31ef2c1473964af7641a5fc341b65fd840bf6a8 /platform/glfw | |
parent | 21a39306da56c5d2c88447ba5ea053a7f989480a (diff) | |
download | qtlocation-mapboxgl-73ac3c784fe755650dc631e2e722a47890981248.tar.gz |
[core] Remove map bearing setters/getters
Diffstat (limited to 'platform/glfw')
-rw-r--r-- | platform/glfw/glfw_view.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 78239bb97b..d222112aa2 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -209,7 +209,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, #endif // MBGL_USE_GLES2 case GLFW_KEY_N: if (!mods) - view->map->resetNorth(); + view->map->easeTo(mbgl::CameraOptions().withAngle(0.0), mbgl::AnimationOptions {{mbgl::Milliseconds(500)}}); break; case GLFW_KEY_Z: view->nextOrientation(); @@ -267,13 +267,15 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, routeProgress = 0.0; } + auto camera = routeMap->getCameraOptions(); + auto point = ruler.along(lineString, routeProgress * routeDistance); const mbgl::LatLng center { point.y, point.x }; - auto latLng = routeMap->getLatLng(); + auto latLng = *camera.center; double bearing = ruler.bearing({ latLng.longitude(), latLng.latitude() }, point); - double easing = bearing - routeMap->getBearing(); + double easing = bearing - *camera.angle; easing += easing > 180.0 ? -360.0 : easing < -180 ? 360.0 : 0; - bearing = routeMap->getBearing() + (easing / 20); + bearing = *camera.angle + (easing / 20); routeMap->jumpTo(mbgl::CameraOptions().withCenter(center).withZoom(18.0).withAngle(bearing).withPitch(60.0)); }; view->animateRouteCallback(view->map); |