summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-23 15:26:10 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-25 09:40:00 +0200
commit22f97611eddc0af8ea79b2d46e3d78b6bd339567 (patch)
tree4a7372286b4bd1e50a498c5d71ed82b0bb953ee5
parent4172076d92a2c423761a810014f187d7f4a33bf6 (diff)
downloadqtlocation-mapboxgl-22f97611eddc0af8ea79b2d46e3d78b6bd339567.tar.gz
[core] Remove error-prone setlatLng overload
-rw-r--r--include/mbgl/map/map.hpp1
-rw-r--r--platform/ios/src/MGLMapView.mm4
-rw-r--r--src/mbgl/map/map.cpp8
-rw-r--r--src/mbgl/map/transform.cpp11
-rw-r--r--src/mbgl/map/transform.hpp1
5 files changed, 5 insertions, 20 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index ca6c62d280..fec67eb281 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -75,7 +75,6 @@ public:
// Position
void moveBy(const ScreenCoordinate&, const AnimationOptions& = {});
- void setLatLng(const LatLng&, optional<ScreenCoordinate>, const AnimationOptions& = {});
void setLatLng(const LatLng&, const EdgeInsets&, const AnimationOptions& = {});
void setLatLng(const LatLng&, const AnimationOptions& = {});
LatLng getLatLng(const EdgeInsets& = {}) const;
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 8ab612663c..32c10a2424 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1572,14 +1572,14 @@ public:
{
self.mbglMap.setZoom(newZoom, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
// The gesture recognizer only reports the gesture’s current center
- // point, so use the previous center point to anchor the transition.
+ // point, so use the previous center point to centerPoint the transition.
// If the number of touches has changed, the remembered center point is
// meaningless.
if (self.userTrackingMode == MGLUserTrackingModeNone && pinch.numberOfTouches == _previousPinchNumberOfTouches)
{
CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate;
self.mbglMap.setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate),
- mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
+ mbgl::EdgeInsets { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x });
}
}
[self cameraIsChanging];
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 1f64cf3acc..983d43eed3 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -304,7 +304,7 @@ void Map::moveBy(const ScreenCoordinate& point, const AnimationOptions& animatio
void Map::setLatLng(const LatLng& latLng, const AnimationOptions& animation) {
impl->cameraMutated = true;
- setLatLng(latLng, optional<ScreenCoordinate> {}, animation);
+ setLatLng(latLng, animation);
}
void Map::setLatLng(const LatLng& latLng, const EdgeInsets& padding, const AnimationOptions& animation) {
@@ -313,12 +313,6 @@ void Map::setLatLng(const LatLng& latLng, const EdgeInsets& padding, const Anima
impl->onUpdate();
}
-void Map::setLatLng(const LatLng& latLng, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
- impl->cameraMutated = true;
- impl->transform.setLatLng(latLng, anchor, animation);
- impl->onUpdate();
-}
-
LatLng Map::getLatLng(const EdgeInsets& padding) const {
return impl->transform.getLatLng(padding);
}
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 0d633499cf..9b2e2a7812 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -323,22 +323,15 @@ void Transform::moveBy(const ScreenCoordinate& offset, const AnimationOptions& a
}
void Transform::setLatLng(const LatLng& latLng, const AnimationOptions& animation) {
- setLatLng(latLng, optional<ScreenCoordinate> {}, animation);
-}
-
-void Transform::setLatLng(const LatLng& latLng, const EdgeInsets& padding, const AnimationOptions& animation) {
CameraOptions camera;
camera.center = latLng;
- camera.padding = padding;
easeTo(camera, animation);
}
-void Transform::setLatLng(const LatLng& latLng, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
+void Transform::setLatLng(const LatLng& latLng, const EdgeInsets& padding, const AnimationOptions& animation) {
CameraOptions camera;
camera.center = latLng;
- if (anchor) {
- camera.padding = EdgeInsets(anchor->y, anchor->x, state.size.height - anchor->y, state.size.width - anchor->x);
- }
+ camera.padding = padding;
easeTo(camera, animation);
}
diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp
index bff44a2dcd..96573b1519 100644
--- a/src/mbgl/map/transform.hpp
+++ b/src/mbgl/map/transform.hpp
@@ -48,7 +48,6 @@ public:
void moveBy(const ScreenCoordinate& offset, const AnimationOptions& = {});
void setLatLng(const LatLng&, const AnimationOptions& = {});
void setLatLng(const LatLng&, const EdgeInsets&, const AnimationOptions& = {});
- void setLatLng(const LatLng&, optional<ScreenCoordinate>, const AnimationOptions& = {});
void setLatLngZoom(const LatLng&, double zoom, const AnimationOptions& = {});
void setLatLngZoom(const LatLng&, double zoom, const EdgeInsets&, const AnimationOptions& = {});
LatLng getLatLng(const EdgeInsets& = {}) const;