summaryrefslogtreecommitdiff
path: root/src/mbgl/map/transform.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-11 13:30:03 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-13 10:28:44 -0700
commitf1c06f8d837b57c1b10677fb5317f0bf20987cf6 (patch)
treefe64a8ca383b76318f0ee10c778460f5a879b3ad /src/mbgl/map/transform.cpp
parenta2670336d4387782bb607092f3a06814bdf4eb8d (diff)
downloadqtlocation-mapboxgl-f1c06f8d837b57c1b10677fb5317f0bf20987cf6.tar.gz
[all] Remove redundant scale-related camera methods
We don't need to have two different measurement systems for map zoom.
Diffstat (limited to 'src/mbgl/map/transform.cpp')
-rw-r--r--src/mbgl/map/transform.cpp46
1 files changed, 11 insertions, 35 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index eab40a6ee5..67729f7fe2 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -384,52 +384,28 @@ ScreenCoordinate Transform::getScreenCoordinate(const EdgeInsets& padding) const
#pragma mark - Zoom
-void Transform::scaleBy(double ds, const AnimationOptions& animation) {
- scaleBy(ds, optional<ScreenCoordinate> {}, animation);
-}
-
-void Transform::scaleBy(double ds, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
- if (std::isnan(ds)) return;
- double scale = util::clamp(state.scale * ds, state.min_scale, state.max_scale);
- setScale(scale, anchor, animation);
-}
-
void Transform::setZoom(double zoom, const AnimationOptions& animation) {
- setZoom(zoom, optional<ScreenCoordinate> {}, animation);
+ CameraOptions camera;
+ camera.zoom = zoom;
+ easeTo(camera, animation);
}
void Transform::setZoom(double zoom, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
- setScale(state.zoomScale(zoom), anchor, animation);
+ CameraOptions camera;
+ camera.zoom = zoom;
+ camera.anchor = anchor;
+ easeTo(camera, animation);
}
void Transform::setZoom(double zoom, const EdgeInsets& padding, const AnimationOptions& animation) {
- setScale(state.zoomScale(zoom), padding, animation);
-}
-
-double Transform::getZoom() const {
- return state.getZoom();
-}
-
-double Transform::getScale() const {
- return state.scale;
-}
-
-void Transform::setScale(double scale, const AnimationOptions& animation) {
- setScale(scale, optional<ScreenCoordinate> {}, animation);
-}
-
-void Transform::setScale(double scale, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
- if (std::isnan(scale)) return;
CameraOptions camera;
- camera.zoom = state.scaleZoom(scale);
- camera.anchor = anchor;
+ camera.zoom = zoom;
+ if (!padding.isFlush()) camera.anchor = getScreenCoordinate(padding);
easeTo(camera, animation);
}
-void Transform::setScale(double scale, const EdgeInsets& padding, const AnimationOptions& animation) {
- optional<ScreenCoordinate> anchor;
- if (!padding.isFlush()) anchor = getScreenCoordinate(padding);
- setScale(scale, anchor, animation);
+double Transform::getZoom() const {
+ return state.getZoom();
}
#pragma mark - Bounds