summaryrefslogtreecommitdiff
path: root/src/mbgl/map
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-04 07:35:26 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-06 09:22:51 -0700
commit16a2839e23d42d4640ef028d62dc01322a0d2e5a (patch)
treeb8b8ba6e7c9f2e91cc3ec230bb9420e3827f3c27 /src/mbgl/map
parenta261f7ff532584b3bbbe4ddef2d0ff96a1ee65a5 (diff)
downloadqtlocation-mapboxgl-16a2839e23d42d4640ef028d62dc01322a0d2e5a.tar.gz
[all] Make LatLng coordinates read-only
Diffstat (limited to 'src/mbgl/map')
-rw-r--r--src/mbgl/map/transform.cpp4
-rw-r--r--src/mbgl/map/transform_state.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 71d216f1ed..c30b8d9687 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -103,7 +103,9 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
// If gesture in progress, we transfer the world rounds from the end
// longitude into start, so we can guarantee the "scroll effect" of rounding
// the world while assuring the end longitude remains wrapped.
- if (isGestureInProgress()) startLatLng.longitude -= unwrappedLatLng.longitude - latLng.longitude;
+ if (isGestureInProgress()) {
+ startLatLng = LatLng(startLatLng.latitude(), startLatLng.longitude() - (unwrappedLatLng.longitude() - latLng.longitude()));
+ }
// Find the shortest path otherwise.
else startLatLng.unwrapForShortestPath(latLng);
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index f7419fa5b4..3fae7b205c 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -325,10 +325,10 @@ void TransformState::setLatLngZoom(const LatLng &latLng, double zoom) {
Cc = newWorldSize / util::M2PI;
const double m = 1 - 1e-15;
- const double f = util::clamp(std::sin(util::DEG2RAD * latLng.latitude), -m, m);
+ const double f = util::clamp(std::sin(util::DEG2RAD * latLng.latitude()), -m, m);
ScreenCoordinate point = {
- -latLng.longitude * Bc,
+ -latLng.longitude() * Bc,
0.5 * Cc * std::log((1 + f) / (1 - f)),
};
setScalePoint(newScale, point);