fixes #279: remove forced rotation animations for now

This commit is contained in:
Justin R. Miller
2014-06-01 18:00:28 -07:00
parent e5a78c931a
commit 38dd25a85a
5 changed files with 7 additions and 27 deletions

View File

@@ -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<util::transition> scale_timeout;
std::shared_ptr<util::transition> rotate_timeout;
std::shared_ptr<util::transition> pan_timeout;
std::shared_ptr<util::transition> interaction_timeout;
};
}

View File

@@ -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;

View File

@@ -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<util::ease_transition<double>>(
current.angle, final.angle, current.angle, start, duration));
if (disable_interaction) {
transitions.remove(interaction_timeout);
current.interactive = false;
interaction_timeout = std::make_shared<util::timeout<bool>>(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

View File

@@ -122,13 +122,6 @@ bool TransformState::isChanging() const {
}
#pragma mark - Interactive
bool TransformState::isInteractive() const {
return interactive;
}
#pragma mark - (private helper functions)