diff --git a/common/map_view.cpp b/common/map_view.cpp index de31c1fa0..8b913cd0c 100644 --- a/common/map_view.cpp +++ b/common/map_view.cpp @@ -136,10 +136,7 @@ public: if (button == GLFW_MOUSE_BUTTON_RIGHT || (button == GLFW_MOUSE_BUTTON_LEFT && modifiers & GLFW_MOD_CONTROL)) { mapView->rotating = action == GLFW_PRESS; - if (mapView->rotating) { - mapView->start_x = mapView->last_x; - mapView->start_y = mapView->last_y; - } else { + if (!mapView->rotating) { mapView->map.stopRotating(); } } else if (button == GLFW_MOUSE_BUTTON_LEFT) { @@ -167,7 +164,7 @@ public: } } else if (mapView->rotating) { mapView->map.startRotating(); - mapView->map.rotateBy(mapView->start_x, mapView->start_y, mapView->last_x, mapView->last_y, x, y); + mapView->map.rotateBy(mapView->last_x, mapView->last_y, x, y); } mapView->last_x = x; mapView->last_y = y; @@ -222,7 +219,6 @@ public: double last_x = 0, last_y = 0; bool tracking = false; - double start_x = 0, start_y = 0; bool rotating = false; double last_click = -1; diff --git a/include/llmr/map/map.hpp b/include/llmr/map/map.hpp index 8e94d0726..0b87c7ae6 100644 --- a/include/llmr/map/map.hpp +++ b/include/llmr/map/map.hpp @@ -57,7 +57,7 @@ public: void stopScaling(); /* rotation */ - void rotateBy(double cx, double cy, double sx, double sy, double ex, double ey, double duration = 0); + void rotateBy(double sx, double sy, double ex, double ey, double duration = 0); void setAngle(double angle, double cx = -1, double cy = -1, double duration = 0); double getAngle() const; void resetNorth(); diff --git a/include/llmr/map/transform.hpp b/include/llmr/map/transform.hpp index e81b9e412..6cf0295ef 100644 --- a/include/llmr/map/transform.hpp +++ b/include/llmr/map/transform.hpp @@ -29,7 +29,7 @@ public: // Relative changes void moveBy(double dx, double dy, double duration = 0); void scaleBy(double ds, double cx = -1, double cy = -1, double duration = 0); - void rotateBy(double cx, double cy, double sx, double sy, double ex, double ey, double duration = 0); + void rotateBy(double sx, double sy, double ex, double ey, double duration = 0); // Absolute changes void setScale(double scale, double cx = -1, double cy = -1, double duration = 0); diff --git a/src/map/map.cpp b/src/map/map.cpp index c0bdba287..b85d56b8e 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -137,8 +137,8 @@ void Map::stopScaling() { platform::restart(); } -void Map::rotateBy(double cx, double cy, double sx, double sy, double ex, double ey, double duration) { - transform.rotateBy(cx, cy, sx, sy, ex, ey, duration); +void Map::rotateBy(double sx, double sy, double ex, double ey, double duration) { + transform.rotateBy(sx, sy, ex, ey, duration); update(); settings.angle = transform.getAngle(); diff --git a/src/map/transform.cpp b/src/map/transform.cpp index 545de6e80..5dfd8c089 100644 --- a/src/map/transform.cpp +++ b/src/map/transform.cpp @@ -107,7 +107,7 @@ void Transform::stopScaling() { } } -void Transform::rotateBy(double anchor_x, double anchor_y, double start_x, double start_y, double end_x, double end_y, double duration) { +void Transform::rotateBy(double start_x, double start_y, double end_x, double end_y, double duration) { double center_x = width / 2, center_y = height / 2; const double begin_center_x = start_x - center_x;