From 09a377ab0162490c8214256cfabd46c0dd8be852 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Mon, 20 Aug 2018 13:28:32 -0700 Subject: [ios, macos] Update shapeAnnotationIsEnabled documentation, improve code readability. --- platform/ios/CHANGELOG.md | 2 +- platform/ios/src/MGLMapView.mm | 5 ++--- platform/ios/src/MGLMapViewDelegate.h | 4 ++-- platform/macos/CHANGELOG.md | 2 +- platform/macos/src/MGLMapView.mm | 5 ++--- platform/macos/src/MGLMapViewDelegate.h | 4 ++-- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 9994de5f3b..ac45bbff55 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -9,7 +9,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * The `-[MGLMapView visibleFeaturesAtPoint:]` method can now return features near tile boundaries at high zoom levels. ([#12570](https://github.com/mapbox/mapbox-gl-native/pull/12570)) * Fixed inconsistencies in exception naming. ([#12583](https://github.com/mapbox/mapbox-gl-native/issues/12583)) * Added `MGLShapeOfflineRegion` for defining arbitrarily shaped offline regions [#11447](https://github.com/mapbox/mapbox-gl-native/pull/11447) -* Added an -[MGLMapViewDelegate mapView:shapeAnnotationIsEnabled:] method to specify whether an annotation is selectable. ([#12352](https://github.com/mapbox/mapbox-gl-native/pull/12352)) +* Added an `-[MGLMapViewDelegate mapView:shapeAnnotationIsEnabled:]` method to specify whether an annotation is selectable. ([#12352](https://github.com/mapbox/mapbox-gl-native/pull/12352)) ## 4.3.0 - August 15, 2018 diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 00bc8f1782..8ca41b328c 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -4183,9 +4183,8 @@ public: { if ([annotation isKindOfClass:[MGLMultiPoint class]]) { - if ([self.delegate respondsToSelector:@selector(mapView:shapeAnnotationIsEnabled:)] && - ![self.delegate mapView:self shapeAnnotationIsEnabled:(MGLMultiPoint *)annotation]) { - return true; + if ([self.delegate respondsToSelector:@selector(mapView:shapeAnnotationIsEnabled:)]) { + return !!(![self.delegate mapView:self shapeAnnotationIsEnabled:(MGLMultiPoint *)annotation]); } else { return false; } diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h index 75d81a5a8f..4bd1a95c9b 100644 --- a/platform/ios/src/MGLMapViewDelegate.h +++ b/platform/ios/src/MGLMapViewDelegate.h @@ -435,8 +435,8 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a Boolean value indicating whether the shape annotation can be selected. - If the return value is YES, the user can select the annotation by tapping [clicking] - on it. If the delegate does not implement this method, the default value is YES. + If the return value is `YES`, the user can select the annotation by tapping + on it. If the delegate does not implement this method, the default value is `YES`. @param mapView The map view that has selected the annotation. @param annotation The object representing the shape annotation. diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 631f21efc6..c0c751d370 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -6,7 +6,7 @@ * The `-[MGLMapView annotationAtPoint:]` method can now return annotations near tile boundaries at high zoom levels. ([#12570](https://github.com/mapbox/mapbox-gl-native/pull/12570)) * Fixed inconsistencies in exception naming. ([#12583](https://github.com/mapbox/mapbox-gl-native/issues/12583)) * Added `MGLShapeOfflineRegion` for defining arbitrarily shaped offline regions [#11447](https://github.com/mapbox/mapbox-gl-native/pull/11447) -* Added an -[MGLMapViewDelegate mapView:shapeAnnotationIsEnabled:] method to specify whether an annotation is selectable. ([#12352](https://github.com/mapbox/mapbox-gl-native/pull/12352)) +* Added an `-[MGLMapViewDelegate mapView:shapeAnnotationIsEnabled:]` method to specify whether an annotation is selectable. ([#12352](https://github.com/mapbox/mapbox-gl-native/pull/12352)) # 0.10.0 - August 15, 2018 diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index a4ed32efe4..3c1fe18499 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -2108,9 +2108,8 @@ public: if ([annotation isKindOfClass:[MGLMultiPoint class]]) { - if ([self.delegate respondsToSelector:@selector(mapView:shapeAnnotationIsEnabled:)] && - ![self.delegate mapView:self shapeAnnotationIsEnabled:(MGLMultiPoint *)annotation]) { - return true; + if ([self.delegate respondsToSelector:@selector(mapView:shapeAnnotationIsEnabled:)]) { + return !!(![self.delegate mapView:self shapeAnnotationIsEnabled:(MGLMultiPoint *)annotation]); } else { return false; } diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h index 18638a61a0..2a8b28c1b4 100644 --- a/platform/macos/src/MGLMapViewDelegate.h +++ b/platform/macos/src/MGLMapViewDelegate.h @@ -246,8 +246,8 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a Boolean value indicating whether the shape annotation can be selected. - If the return value is YES, the user can select the annotation by tapping [clicking] - on it. If the delegate does not implement this method, the default value is YES. + If the return value is `YES`, the user can select the annotation by clicking + on it. If the delegate does not implement this method, the default value is `YES`. @param mapView The map view that has selected the annotation. @param annotation The object representing the shape annotation. -- cgit v1.2.1