summaryrefslogtreecommitdiff
path: root/macosx
diff options
context:
space:
mode:
authorKonstantin Käfer <github@kkaefer.com>2014-01-09 11:04:56 +0100
committerKonstantin Käfer <github@kkaefer.com>2014-01-09 11:04:56 +0100
commit16d0c83df2b1a882eae1c4d988a84bca5fe84e9a (patch)
treef896dd74b8e2a6b75d6999f102003717fa0aa9f0 /macosx
parenta7205b339e8d1c8dee54eaaa38b3efba2df3820e (diff)
downloadqtlocation-mapboxgl-16d0c83df2b1a882eae1c4d988a84bca5fe84e9a.tar.gz
copy rotation behavior from js version
Diffstat (limited to 'macosx')
-rw-r--r--macosx/main.mm17
1 files changed, 8 insertions, 9 deletions
diff --git a/macosx/main.mm b/macosx/main.mm
index ac3fcdb31f..3119d2b869 100644
--- a/macosx/main.mm
+++ b/macosx/main.mm
@@ -75,7 +75,13 @@ public:
static void mouseclick(GLFWwindow *window, int button, int action, int modifiers) {
MapView *view = (MapView *)glfwGetWindowUserPointer(window);
- if (button == GLFW_MOUSE_BUTTON_LEFT) {
+ if (button == GLFW_MOUSE_BUTTON_RIGHT || (button == GLFW_MOUSE_BUTTON_LEFT && modifiers & GLFW_MOD_CONTROL)) {
+ view->rotating = action == GLFW_PRESS;
+ if (view->rotating) {
+ view->start_x = view->last_x;
+ view->start_y = view->last_y;
+ }
+ } else if (button == GLFW_MOUSE_BUTTON_LEFT) {
view->tracking = action == GLFW_PRESS;
if (action == GLFW_RELEASE) {
@@ -85,14 +91,7 @@ public:
}
view->last_click = now;
}
- } 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;
- }
}
-
}
static void mousemove(GLFWwindow *window, double x, double y) {
@@ -100,7 +99,7 @@ public:
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->map->rotateBy(view->start_x, view->start_y, view->last_x, view->last_y, x, y);
}
view->last_x = x;
view->last_y = y;