From 4fc8226838a23154ca8acc5e5fcb6144de0794cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 16 Nov 2015 16:32:09 +0100 Subject: [core] allow changing the orientation You can now change the orientation of north to be to the right, bottom, left in addition to the default of top --- platform/default/glfw_view.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'platform/default/glfw_view.cpp') diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index 418f427c74..c83e6c324b 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -92,6 +92,7 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_) printf("- Press `X` to reset the transform\n"); printf("- Press `N` to reset north\n"); printf("- Press `R` to toggle any available `night` style class\n"); + printf("- Press `Z` to cycle through north orientations\n"); printf("\n"); printf("- Press `1` through `6` to add increasing numbers of point annotations for testing\n"); printf("- Press `7` through `0` to add increasing numbers of shape annotations for testing\n"); @@ -153,6 +154,9 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, if (!mods) view->map->resetNorth(); break; + case GLFW_KEY_Z: + view->nextOrientation(); + break; case GLFW_KEY_Q: view->clearAnnotations(); break; @@ -218,6 +222,16 @@ GLFWView::makeSpriteImage(int width, int height, float pixelRatio) { return std::make_shared(width, height, pixelRatio, std::move(pixels)); } +void GLFWView::nextOrientation() { + using NO = mbgl::NorthOrientation; + switch (map->getNorthOrientation()) { + case NO::Upwards: map->setNorthOrientation(NO::Rightwards); break; + case NO::Rightwards: map->setNorthOrientation(NO::Downwards); break; + case NO::Downwards: map->setNorthOrientation(NO::Leftwards); break; + default: map->setNorthOrientation(NO::Upwards); break; + } +} + void GLFWView::addRandomCustomPointAnnotations(int count) { std::vector points; -- cgit v1.2.1