summaryrefslogtreecommitdiff
path: root/platform/glfw/glfw_view.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/glfw/glfw_view.cpp')
-rw-r--r--platform/glfw/glfw_view.cpp10
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);