diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-11-16 16:32:09 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-12-15 11:41:58 -0800 |
commit | 4fc8226838a23154ca8acc5e5fcb6144de0794cb (patch) | |
tree | ac2354fda5e9bca147d7eb3f5bdddbaa291dc319 /platform/default/glfw_view.cpp | |
parent | 62412af6ab746dd8fb5b8984c75b3ff6e6b223e5 (diff) | |
download | qtlocation-mapboxgl-4fc8226838a23154ca8acc5e5fcb6144de0794cb.tar.gz |
[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
Diffstat (limited to 'platform/default/glfw_view.cpp')
-rw-r--r-- | platform/default/glfw_view.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<mbgl::SpriteImage>(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<mbgl::PointAnnotation> points; |