diff options
author | Konstantin Käfer <github@kkaefer.com> | 2014-01-08 17:31:35 +0100 |
---|---|---|
committer | Konstantin Käfer <github@kkaefer.com> | 2014-01-08 17:31:35 +0100 |
commit | 04d9d6b9f906fd65a56a6956ed0d648d99713d75 (patch) | |
tree | a7d531cec7acf3cb300d12b71ef6c8ca757571ec /macosx | |
parent | 7526d681e287264d4b4f7b81e3f7cd68dae97bfb (diff) | |
download | qtlocation-mapboxgl-04d9d6b9f906fd65a56a6956ed0d648d99713d75.tar.gz |
rotation support
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/main.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/macosx/main.mm b/macosx/main.mm index 864803354a..549cd2b059 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -72,8 +72,14 @@ public: static void mouseclick(GLFWwindow *window, int button, int action, int modifiers) { MapView *view = (MapView *)glfwGetWindowUserPointer(window); - if (button == GLFW_MOUSE_BUTTON_1) { + if (button == GLFW_MOUSE_BUTTON_LEFT) { view->tracking = action == GLFW_PRESS; + } else if (button == GLFW_MOUSE_BUTTON_RIGHT) { + view->rotating = action == GLFW_PRESS; + if (view->rotating) { + view->start_x = view->last_x; + view->start_y = view->last_y; + } } } @@ -81,6 +87,8 @@ public: MapView *view = (MapView *)glfwGetWindowUserPointer(window); if (view->tracking) { view->map->moveBy(x - view->last_x, y - view->last_y); + } else if (view->rotating) { + view->map->rotateBy(view->start_x, view->start_y, x - view->last_x, y - view->last_y); } view->last_x = x; view->last_y = y; @@ -133,6 +141,9 @@ public: double last_x, last_y; bool tracking; + double start_x, start_y; + bool rotating; + GLFWwindow *window; llmr::platform *platform; llmr::map *map; |