[ios] Fix issue wrong position of attribution dialog after rotation (#14185)
* Fix issue #12897
This commit is contained in:
@@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
|
||||
## 4.11.0
|
||||
|
||||
* Fixed an Interface Builder crash when using an `MGLMapView` in a storyboard. ([#14379](https://github.com/mapbox/mapbox-gl-native/pull/14379))
|
||||
* Fix a bug that wrong position of attribution dialog after rotation. ([#14185](https://github.com/mapbox/mapbox-gl-native/pull/14185))
|
||||
|
||||
## 4.10.0
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@ public:
|
||||
@property (nonatomic) NSMutableArray<NSLayoutConstraint *> *logoViewConstraints;
|
||||
@property (nonatomic, readwrite) UIButton *attributionButton;
|
||||
@property (nonatomic) NSMutableArray<NSLayoutConstraint *> *attributionButtonConstraints;
|
||||
@property (nonatomic, weak) UIAlertController *attributionController;
|
||||
|
||||
@property (nonatomic, readwrite) MGLStyle *style;
|
||||
|
||||
@@ -1016,6 +1017,8 @@ public:
|
||||
}
|
||||
|
||||
[self updateUserLocationAnnotationView];
|
||||
|
||||
[self updateAttributionAlertView];
|
||||
}
|
||||
|
||||
/// Updates `contentInset` to reflect the current window geometry.
|
||||
@@ -2417,6 +2420,7 @@ public:
|
||||
|
||||
UIViewController *viewController = [self.window.rootViewController mgl_topMostViewController];
|
||||
[viewController presentViewController:attributionController animated:YES completion:NULL];
|
||||
self.attributionController = attributionController;
|
||||
}
|
||||
|
||||
- (void)presentTelemetryAlertController
|
||||
@@ -6405,6 +6409,23 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateAttributionAlertView {
|
||||
if (self.attributionController.presentingViewController) {
|
||||
self.attributionController.popoverPresentationController.sourceRect = self.attributionButton.frame;
|
||||
switch (self.attributionButtonPosition) {
|
||||
case MGLOrnamentPositionTopLeft:
|
||||
case MGLOrnamentPositionTopRight:
|
||||
[self.attributionController.popoverPresentationController setPermittedArrowDirections:UIMenuControllerArrowUp];
|
||||
break;
|
||||
case MGLOrnamentPositionBottomLeft:
|
||||
case MGLOrnamentPositionBottomRight:
|
||||
[self.attributionController.popoverPresentationController setPermittedArrowDirections:UIMenuControllerArrowDown];
|
||||
break;
|
||||
}
|
||||
[self.attributionController.popoverPresentationController.containerView setNeedsLayout];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enqueueAnnotationViewForAnnotationContext:(MGLAnnotationContext &)annotationContext
|
||||
{
|
||||
MGLAnnotationView *annotationView = annotationContext.annotationView;
|
||||
|
||||
Reference in New Issue
Block a user