summaryrefslogtreecommitdiff
path: root/include/mbgl/map
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-10 17:28:21 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-14 00:39:18 -0800
commitd26b956a48dc2da9333b40d8d2c4371c63b372a2 (patch)
tree630a714a50e23cc0338fda687fddcfa832fa62a5 /include/mbgl/map
parent27b308a23482660d705eb82457a21213bc12599e (diff)
downloadqtlocation-mapboxgl-d26b956a48dc2da9333b40d8d2c4371c63b372a2.tar.gz
[core] Cleaned up Transform
Eliminated many redundant methods on Transform. Minimized usage of TransformState::x and TransformState::y. Added convenient constructors for AnimationOptions. When scaling, passing in view’s origin as the anchor no longer anchors the scaling operation at the view’s center. To specify no anchor, use NaN. Increased precision of worldSize(), now that it’s used much more heavily in transform methods.
Diffstat (limited to 'include/mbgl/map')
-rw-r--r--include/mbgl/map/camera.hpp7
-rw-r--r--include/mbgl/map/map.hpp4
2 files changed, 9 insertions, 2 deletions
diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp
index 87adc46910..95be4e8178 100644
--- a/include/mbgl/map/camera.hpp
+++ b/include/mbgl/map/camera.hpp
@@ -59,6 +59,13 @@ struct AnimationOptions {
/** A function that is called once on the last frame of the transition, just
before the corresponding screen update. */
std::function<void()> transitionFinishFn;
+
+ /** Creates an animation with no options specified. */
+ inline AnimationOptions() {}
+
+ /** Creates an animation with the specified duration. */
+ inline AnimationOptions(Duration d)
+ : duration(d) {}
};
} // namespace mbgl
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 4a6b85b28f..3e52d57d19 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -111,8 +111,8 @@ public:
void resetPosition();
// Scale
- void scaleBy(double ds, const PrecisionPoint& = { 0, 0 }, const Duration& = Duration::zero());
- void setScale(double scale, const PrecisionPoint& = { 0, 0 }, const Duration& = Duration::zero());
+ void scaleBy(double ds, const PrecisionPoint& = { NAN, NAN }, const Duration& = Duration::zero());
+ void setScale(double scale, const PrecisionPoint& = { NAN, NAN }, const Duration& = Duration::zero());
double getScale() const;
void setZoom(double zoom, const Duration& = Duration::zero());
double getZoom() const;