diff options
author | Julian Rex <julian.rex@mapbox.com> | 2018-10-05 16:32:10 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2018-10-06 00:58:40 -0400 |
commit | f3dc57372a6a6f0314c0f3568ecf2e81157b743f (patch) | |
tree | b8615f59f9ccd2d7fe66d0ff0ca24e673ac31632 | |
parent | 0e30aba216d4d33c6787280080d074f4f6680c1a (diff) | |
download | qtlocation-mapboxgl-f3dc57372a6a6f0314c0f3568ecf2e81157b743f.tar.gz |
Renamed "moveOnscreen" to "expose"
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 32 | ||||
-rw-r--r-- | platform/ios/src/MGLMapViewDelegate.h | 2 | ||||
-rw-r--r-- | platform/ios/test/MGLMapViewDelegateIntegrationTests.swift | 2 |
3 files changed, 18 insertions, 18 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 6f89d43051..3d986adf3b 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1718,13 +1718,13 @@ public: CGPoint calloutPoint = [singleTap locationInView:self]; CGRect positionRect = [self positioningRectForAnnotation:annotation defaultCalloutPoint:calloutPoint]; - BOOL moveOnscreen = YES; + BOOL expose = YES; - if ([self.delegate respondsToSelector:@selector(mapView:shouldMoveAnnotationOnscreenInResponseToUserSelection:)]) { - moveOnscreen = [self.delegate mapView:self shouldMoveAnnotationOnscreenInResponseToUserSelection:annotation]; + if ([self.delegate respondsToSelector:@selector(mapView:shouldExposeAnnotationInResponseToUserSelection:)]) { + expose = [self.delegate mapView:self shouldExposeAnnotationInResponseToUserSelection:annotation]; } - [self selectAnnotation:annotation animated:YES moveOnscreen:moveOnscreen calloutPositioningRect:positionRect]; + [self selectAnnotation:annotation animated:YES expose:expose calloutPositioningRect:positionRect]; } else if (self.selectedAnnotation) { @@ -4375,17 +4375,17 @@ public: - (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated { - [self selectAnnotation:annotation animated:animated moveOnscreen:animated]; + [self selectAnnotation:annotation animated:animated expose:animated]; } -- (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated moveOnscreen:(BOOL)moveOnscreen +- (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated expose:(BOOL)expose { CGRect positioningRect = [self positioningRectForAnnotation:annotation defaultCalloutPoint:CGPointZero]; - [self selectAnnotation:annotation animated:animated moveOnscreen:moveOnscreen calloutPositioningRect:positioningRect]; + [self selectAnnotation:annotation animated:animated expose:expose calloutPositioningRect:positioningRect]; } -- (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated moveOnscreen:(BOOL)moveOnscreen calloutPositioningRect:(CGRect)calloutPositioningRect +- (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated expose:(BOOL)expose calloutPositioningRect:(CGRect)calloutPositioningRect { if ( ! annotation) return; @@ -4500,7 +4500,7 @@ public: // If the callout view provides inset (outset) information, we can use it to expand our positioning // rect, which we then use to help move the annotation on-screen if want need to. - if (moveOnscreen) { + if (expose) { UIEdgeInsets margins = MGLMapViewOffscreenAnnotationPadding; if ([calloutView respondsToSelector:@selector(marginInsetsHintForPresentationFromRect:)]) { @@ -4511,9 +4511,9 @@ public: } } - if (moveOnscreen) + if (expose) { - moveOnscreen = NO; + expose = NO; // Need to consider the content insets. CGRect bounds = constrainedRect; @@ -4523,14 +4523,14 @@ public: if (minX < CGRectGetMinX(bounds)) { constrainedRect.origin.x = minX; - moveOnscreen = YES; + expose = YES; } else { CGFloat maxX = CGRectGetMaxX(expandedPositioningRect); if (maxX > CGRectGetMaxX(bounds)) { constrainedRect.origin.x = maxX - CGRectGetWidth(constrainedRect); - moveOnscreen = YES; + expose = YES; } } @@ -4538,14 +4538,14 @@ public: if (minY < CGRectGetMinY(bounds)) { constrainedRect.origin.y = minY; - moveOnscreen = YES; + expose = YES; } else { CGFloat maxY = CGRectGetMaxY(expandedPositioningRect); if (maxY > CGRectGetMaxY(bounds)) { constrainedRect.origin.y = maxY - CGRectGetHeight(constrainedRect); - moveOnscreen = YES; + expose = YES; } } } @@ -4571,7 +4571,7 @@ public: [self.delegate mapView:self didSelectAnnotationView:annotationView]; } - if (moveOnscreen) + if (expose) { CGPoint center = CGPointMake(CGRectGetMidX(constrainedRect), CGRectGetMidY(constrainedRect)); CLLocationCoordinate2D centerCoord = [self convertPoint:center toCoordinateFromView:self]; diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h index c7dc4b1ea8..40096619f6 100644 --- a/platform/ios/src/MGLMapViewDelegate.h +++ b/platform/ios/src/MGLMapViewDelegate.h @@ -472,7 +472,7 @@ NS_ASSUME_NONNULL_BEGIN @param annotation The object representing the shape annotation. @return A Boolean value indicating whether the annotation should be moved onscreen if it and its callout (if it has one) are offscreen. */ -- (BOOL)mapView:(MGLMapView *)mapView shouldMoveAnnotationOnscreenInResponseToUserSelection:(id <MGLAnnotation>)annotation; +- (BOOL)mapView:(MGLMapView *)mapView shouldExposeAnnotationInResponseToUserSelection:(id <MGLAnnotation>)annotation; /** Tells the delegate that one of its annotations was selected. diff --git a/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift b/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift index 649c16d11e..a870cfa79a 100644 --- a/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift +++ b/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift @@ -33,7 +33,7 @@ extension MGLMapViewDelegateIntegrationTests: MGLMapViewDelegate { func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {} - func mapView(_ mapView: MGLMapView, shouldMoveAnnotationOnscreenInResponseToUserSelection annotation: MGLAnnotation) -> Bool { return true } + func mapView(_ mapView: MGLMapView, shouldExposeAnnotationInResponseToUserSelection annotation: MGLAnnotation) -> Bool { return true } func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {} func mapView(_ mapView: MGLMapView, didDeselect annotation: MGLAnnotation) {} |