[core] Remove error-prone setlatLng overload

This commit is contained in:
Bruno de Oliveira Abinader
2018-11-23 15:26:10 +02:00
parent 9d1d4ecdb8
commit e8f7866e9e
5 changed files with 5 additions and 20 deletions

View File

@@ -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;

View File

@@ -1579,7 +1579,7 @@ public:
{
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];

View File

@@ -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);
}

View File

@@ -323,7 +323,9 @@ void Transform::moveBy(const ScreenCoordinate& offset, const AnimationOptions& a
}
void Transform::setLatLng(const LatLng& latLng, const AnimationOptions& animation) {
setLatLng(latLng, optional<ScreenCoordinate> {}, animation);
CameraOptions camera;
camera.center = latLng;
easeTo(camera, animation);
}
void Transform::setLatLng(const LatLng& latLng, const EdgeInsets& padding, const AnimationOptions& animation) {
@@ -333,15 +335,6 @@ void Transform::setLatLng(const LatLng& latLng, const EdgeInsets& padding, const
easeTo(camera, animation);
}
void Transform::setLatLng(const LatLng& latLng, optional<ScreenCoordinate> anchor, 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);
}
easeTo(camera, animation);
}
void Transform::setLatLngZoom(const LatLng& latLng, double zoom, const AnimationOptions& animation) {
setLatLngZoom(latLng, zoom, EdgeInsets(), animation);
}

View File

@@ -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;