summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llmr/map/transform.hpp2
-rw-r--r--macosx/main.mm14
2 files changed, 14 insertions, 2 deletions
diff --git a/include/llmr/map/transform.hpp b/include/llmr/map/transform.hpp
index 249ce9721e..3f5f8dc3a6 100644
--- a/include/llmr/map/transform.hpp
+++ b/include/llmr/map/transform.hpp
@@ -21,8 +21,6 @@ public:
void setAngle(double angle);
void setZoom(double zoom);
void setLonLat(double lon, double lat);
- // void setAngle(double angle);
-
// Getters
void matrixFor(float matrix[16], uint32_t z, uint32_t x, uint32_t y) const;
diff --git a/macosx/main.mm b/macosx/main.mm
index 549cd2b059..ac3fcdb31f 100644
--- a/macosx/main.mm
+++ b/macosx/main.mm
@@ -9,6 +9,8 @@ public:
MapView() :
dirty(true),
tracking(false),
+ rotating(false),
+ last_click(-1),
platform(new llmr::platform(this)),
map(new llmr::map(platform)) {
if (!glfwInit()) {
@@ -72,8 +74,17 @@ public:
static void mouseclick(GLFWwindow *window, int button, int action, int modifiers) {
MapView *view = (MapView *)glfwGetWindowUserPointer(window);
+
if (button == GLFW_MOUSE_BUTTON_LEFT) {
view->tracking = action == GLFW_PRESS;
+
+ if (action == GLFW_RELEASE) {
+ double now = glfwGetTime();
+ if (now - view->last_click < 0.4) {
+ view->map->scaleBy(2.0, view->last_x, view->last_y);
+ }
+ view->last_click = now;
+ }
} else if (button == GLFW_MOUSE_BUTTON_RIGHT) {
view->rotating = action == GLFW_PRESS;
if (view->rotating) {
@@ -81,6 +92,7 @@ public:
view->start_y = view->last_y;
}
}
+
}
static void mousemove(GLFWwindow *window, double x, double y) {
@@ -144,6 +156,8 @@ public:
double start_x, start_y;
bool rotating;
+ double last_click;
+
GLFWwindow *window;
llmr::platform *platform;
llmr::map *map;