disallow/undo rotation at low zooms and near world edge

This commit is contained in:
Justin R. Miller
2014-05-23 18:24:58 -07:00
parent 07e15927af
commit 3c5a2c7935
6 changed files with 70 additions and 10 deletions

View File

@@ -73,6 +73,8 @@ public:
void resetZoom();
void startScaling();
void stopScaling();
double getMinZoom();
double getMaxZoom();
// Rotation
void rotateBy(double sx, double sy, double ex, double ey, double duration = 0);
@@ -82,6 +84,7 @@ public:
void resetNorth();
void startRotating();
void stopRotating();
bool canRotate();
// Debug
void setDebug(bool value);

View File

@@ -37,16 +37,19 @@ public:
void setZoom(double zoom, time duration = 0);
double getZoom() const;
double getScale() const;
void startRotating();
void stopRotating();
void startScaling();
void stopScaling();
double getMinZoom();
double getMaxZoom();
// Angle
void rotateBy(double sx, double sy, double ex, double ey, time duration = 0);
void setAngle(double angle, time duration = 0);
void setAngle(double angle, double cx, double cy);
double getAngle() const;
void startScaling();
void stopScaling();
void startRotating();
void stopRotating();
bool canRotate();
// Transitions
bool needsTransition() const;
@@ -63,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);
void _setAngle(double angle, time duration = 0, bool disable_interaction = false);
void _clearPanning();
void _clearRotating();
void _clearScaling();
@@ -93,6 +96,7 @@ 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,6 +39,9 @@ public:
// Changing
bool isChanging() const;
// Interactive
bool isInteractive() const;
private:
double pixel_x() const;
double pixel_y() const;
@@ -57,6 +60,7 @@ private:
bool rotating = false;
bool scaling = false;
bool panning = false;
bool interactive = true;
// map position
double x = 0, y = 0;