[core] Camera center and anchor points are mutually exclusive

This commit is contained in:
Bruno de Oliveira Abinader
2018-11-23 22:47:40 +02:00
parent 82be3104cd
commit 52cce7925d
3 changed files with 20 additions and 2 deletions

View File

@@ -561,7 +561,9 @@ void Transform::startTransition(const CameraOptions& camera,
observer.onCameraWillChange(isAnimated ? MapObserver::CameraChangeMode::Animated : MapObserver::CameraChangeMode::Immediate);
// Associate the anchor, if given, with a coordinate.
optional<ScreenCoordinate> anchor = camera.anchor;
// Anchor and center points are mutually exclusive, with preference for the
// center point when both are set.
optional<ScreenCoordinate> anchor = camera.center ? nullopt : camera.anchor;
LatLng anchorLatLng;
if (anchor) {
anchor->y = state.size.height - anchor->y;