diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-12-02 16:05:41 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-12-13 17:26:53 -0800 |
commit | ea57be5598826a14991e2ac17a826186c2d9ce0b (patch) | |
tree | 627befa3bfd79915eeac17d75153a4fa2de49ac4 /platform/darwin | |
parent | 73324ae2f886ac32fc673c996b00faf0383d93c0 (diff) | |
download | qtlocation-mapboxgl-ea57be5598826a14991e2ac17a826186c2d9ce0b.tar.gz |
[osx] Documentation comments for public classes
Added documentation comments for all the public headers that aren’t being shared with iOS.
Removed an animated: parameter from -selectAnnotation: and -deselectAnnotation:: because callout popovers may extend beyond the entire window, there is no need to scroll the map to make the entire callout visible.
Added missing geometric conversion methods.
Renamed -mapView:regionWillChangeAnimated: et al. to say “camera” instead of “region”. “Region” leaves ambiguity about whether properties like rotation and pitch trigger this method. “Camera” associates these methods with the camera property, which seems apt.
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/MGLGeometry.m | 3 | ||||
-rw-r--r-- | platform/darwin/MGLGeometry.mm | 21 | ||||
-rw-r--r-- | platform/darwin/MGLGeometry_Private.h | 15 |
3 files changed, 32 insertions, 7 deletions
diff --git a/platform/darwin/MGLGeometry.m b/platform/darwin/MGLGeometry.m deleted file mode 100644 index 9eab5565fa..0000000000 --- a/platform/darwin/MGLGeometry.m +++ /dev/null @@ -1,3 +0,0 @@ -#import "MGLGeometry.h" - -const MGLCoordinateSpan MGLCoordinateSpanZero = {0, 0}; diff --git a/platform/darwin/MGLGeometry.mm b/platform/darwin/MGLGeometry.mm new file mode 100644 index 0000000000..b80203d142 --- /dev/null +++ b/platform/darwin/MGLGeometry.mm @@ -0,0 +1,21 @@ +#import "MGLGeometry_Private.h" + +const MGLCoordinateSpan MGLCoordinateSpanZero = {0, 0}; + +CGRect MGLExtendRect(CGRect rect, CGPoint point) { + if (point.x < rect.origin.x) { + rect.size.width += rect.origin.x - point.x; + rect.origin.x = point.x; + } + if (point.x > rect.origin.x + rect.size.width) { + rect.size.width += point.x - (rect.origin.x + rect.size.width); + } + if (point.y < rect.origin.y) { + rect.size.height += rect.origin.y - point.y; + rect.origin.y = point.y; + } + if (point.y > rect.origin.y + rect.size.height) { + rect.size.height += point.y - (rect.origin.y + rect.size.height); + } + return rect; +} diff --git a/platform/darwin/MGLGeometry_Private.h b/platform/darwin/MGLGeometry_Private.h index 08d1ad3695..49a306701d 100644 --- a/platform/darwin/MGLGeometry_Private.h +++ b/platform/darwin/MGLGeometry_Private.h @@ -1,10 +1,17 @@ #import "MGLGeometry.h" #import <TargetConditionals.h> +#if TARGET_OS_IPHONE + #import <UIKit/UIKit.h> +#endif #import <mbgl/map/map.hpp> #import <mbgl/util/geo.hpp> +/// Returns the smallest rectangle that contains both the given rectangle and +/// the given point. +CGRect MGLExtendRect(CGRect rect, CGPoint point); + NS_INLINE mbgl::LatLng MGLLatLngFromLocationCoordinate2D(CLLocationCoordinate2D coordinate) { return mbgl::LatLng(coordinate.latitude, coordinate.longitude); } @@ -28,12 +35,12 @@ NS_INLINE BOOL MGLCoordinateInCoordinateBounds(CLLocationCoordinate2D coordinate return bounds.contains(MGLLatLngFromLocationCoordinate2D(coordinate)); } -#if TARGET_OS_MAC -NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(NSEdgeInsets insets) { +#if TARGET_OS_IPHONE +NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(UIEdgeInsets insets) { return { insets.top, insets.left, insets.bottom, insets.right }; } -#elif TARGET_OS_IOS -NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(UIEdgeInsets insets) { +#else +NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(NSEdgeInsets insets) { return { insets.top, insets.left, insets.bottom, insets.right }; } #endif |