From 38dd25a85a9ab9f0c6cbd525262e0fb4ed876538 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Sun, 1 Jun 2014 18:00:28 -0700 Subject: [PATCH] fixes #279: remove forced rotation animations for now --- include/llmr/map/transform.hpp | 3 +-- include/llmr/map/transform_state.hpp | 4 ---- ios/mapbox-gl-cocoa | 2 +- src/map/transform.cpp | 18 +++++------------- src/map/transform_state.cpp | 7 ------- 5 files changed, 7 insertions(+), 27 deletions(-) diff --git a/include/llmr/map/transform.hpp b/include/llmr/map/transform.hpp index 31e6f2fc6..63b75d43d 100644 --- a/include/llmr/map/transform.hpp +++ b/include/llmr/map/transform.hpp @@ -66,7 +66,7 @@ private: void _moveBy(double dx, double dy, time duration = 0); void _setScale(double scale, double cx, double cy, time duration = 0); void _setScaleXY(double new_scale, double xn, double yn, time duration = 0); - void _setAngle(double angle, time duration = 0, bool disable_interaction = false); + void _setAngle(double angle, time duration = 0); void _clearPanning(); void _clearRotating(); void _clearScaling(); @@ -96,7 +96,6 @@ private: std::shared_ptr scale_timeout; std::shared_ptr rotate_timeout; std::shared_ptr pan_timeout; - std::shared_ptr interaction_timeout; }; } diff --git a/include/llmr/map/transform_state.hpp b/include/llmr/map/transform_state.hpp index b3794e909..29d0f59c4 100644 --- a/include/llmr/map/transform_state.hpp +++ b/include/llmr/map/transform_state.hpp @@ -39,9 +39,6 @@ public: // Changing bool isChanging() const; - // Interactive - bool isInteractive() const; - private: double pixel_x() const; double pixel_y() const; @@ -60,7 +57,6 @@ private: bool rotating = false; bool scaling = false; bool panning = false; - bool interactive = true; // map position double x = 0, y = 0; diff --git a/ios/mapbox-gl-cocoa b/ios/mapbox-gl-cocoa index 687d84e7c..066a077f2 160000 --- a/ios/mapbox-gl-cocoa +++ b/ios/mapbox-gl-cocoa @@ -1 +1 @@ -Subproject commit 687d84e7c907f94b45cd364e8851d36d738937f4 +Subproject commit 066a077f282ef3abfc29c9b2be0b675d85d92406 diff --git a/src/map/transform.cpp b/src/map/transform.cpp index 1eb0a84c3..adfa41c39 100644 --- a/src/map/transform.cpp +++ b/src/map/transform.cpp @@ -33,7 +33,7 @@ bool Transform::resize(const uint16_t w, const uint16_t h, const float ratio, current.pixelRatio = final.pixelRatio = ratio; current.framebuffer[0] = final.framebuffer[0] = fb_w; current.framebuffer[1] = final.framebuffer[1] = fb_h; - if (!canRotate()) _setAngle(0); + if (!canRotate() && current.angle) _setAngle(0); constrain(current.scale, current.y); platform::notify_map_change(); return true; @@ -62,7 +62,7 @@ void Transform::_moveBy(const double dx, const double dy, const time duration) { double w = final.scale * util::tileSize / 2; double m = std::sqrt(std::pow((current.width / 2), 2) + pow((current.height / 2), 2)); double x = std::abs(sqrt(std::pow(final.x, 2) + std::pow(final.y, 2))); - if (current.angle && w - x < m) _setAngle(0, 500_milliseconds, true); + if (current.angle && w - x < m) _setAngle(0); if (duration == 0) { current.x = final.x; @@ -272,7 +272,7 @@ void Transform::_setScaleXY(const double new_scale, const double xn, const doubl constrain(final.scale, final.y); // Undo rotation at low zooms. - if (!canRotate() && current.angle) _setAngle(0, 500_milliseconds, true); + if (!canRotate() && current.angle) _setAngle(0); if (duration == 0) { current.scale = final.scale; @@ -367,7 +367,7 @@ void Transform::setAngle(const double new_angle, const double cx, const double c } } -void Transform::_setAngle(double new_angle, const time duration, bool disable_interaction) { +void Transform::_setAngle(double new_angle, const time duration) { // This is only called internally, so we don't need a lock here. while (new_angle > M_PI) @@ -382,18 +382,10 @@ void Transform::_setAngle(double new_angle, const time duration, bool disable_in if (duration == 0) { current.angle = final.angle; - transitions.remove(interaction_timeout); - current.interactive = true; } else { time start = util::now(); transitions.emplace_front(std::make_shared>( current.angle, final.angle, current.angle, start, duration)); - if (disable_interaction) { - transitions.remove(interaction_timeout); - current.interactive = false; - interaction_timeout = std::make_shared>(true, current.interactive, start, duration); - transitions.emplace_front(interaction_timeout); - } } platform::notify_map_change(); @@ -434,7 +426,7 @@ void Transform::_clearRotating() { } bool Transform::canRotate() { - return (current.scale >= MIN_ROTATE_SCALE); + return (current.scale > MIN_ROTATE_SCALE); } #pragma mark - Transition diff --git a/src/map/transform_state.cpp b/src/map/transform_state.cpp index 0d495fc6d..cb0a3b6e7 100644 --- a/src/map/transform_state.cpp +++ b/src/map/transform_state.cpp @@ -122,13 +122,6 @@ bool TransformState::isChanging() const { } -#pragma mark - Interactive - -bool TransformState::isInteractive() const { - return interactive; -} - - #pragma mark - (private helper functions)