diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2019-06-03 07:32:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-03 07:32:20 -0700 |
commit | 402645109f8d0535cac132d824d39f38a4f1c558 (patch) | |
tree | 61969265c1e4c6bb9840d8f376260301d7e32556 /platform/darwin | |
parent | b2428835871933ecf5a93e86493bac0b76db0ede (diff) | |
download | qtlocation-mapboxgl-402645109f8d0535cac132d824d39f38a4f1c558.tar.gz |
[ios] Fix content insets with custom edge padding. (#14813)
* [ios] Fix content insets with custom edge padding.
* [ios, macos] Consolidated edge insets math
* [macos] Add content insets to edge padding when setting camera
* [ios, macos] Updated changelogs
* [ios, macos] Clarify setCamera:withDuration:animationTimingFunction:edgePadding method documentation.
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLGeometry_Private.h | 20 | ||||
-rw-r--r-- | platform/darwin/src/NSExpression+MGLAdditions.mm | 3 | ||||
-rw-r--r-- | platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm | 4 |
3 files changed, 17 insertions, 10 deletions
diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h index b91d4e0f81..a89a382c5e 100644 --- a/platform/darwin/src/MGLGeometry_Private.h +++ b/platform/darwin/src/MGLGeometry_Private.h @@ -97,14 +97,24 @@ NS_INLINE BOOL MGLLocationCoordinate2DIsValid(CLLocationCoordinate2D coordinate) } #if TARGET_OS_IPHONE -NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(UIEdgeInsets insets) { - return { insets.top, insets.left, insets.bottom, insets.right }; -} + #define MGLEdgeInsets UIEdgeInsets + #define MGLEdgeInsetsMake UIEdgeInsetsMake #else -NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(NSEdgeInsets insets) { + #define MGLEdgeInsets NSEdgeInsets + #define MGLEdgeInsetsMake NSEdgeInsetsMake +#endif + +NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(MGLEdgeInsets insets) { return { insets.top, insets.left, insets.bottom, insets.right }; } -#endif + +/// Returns the combination of two edge insets. +NS_INLINE MGLEdgeInsets MGLEdgeInsetsInsetEdgeInset(MGLEdgeInsets base, MGLEdgeInsets inset) { + return MGLEdgeInsetsMake(base.top + inset.top, + base.left + inset.left, + base.bottom + inset.bottom, + base.right + inset.right); +} /** Returns MGLRadianCoordinate2D, converted from CLLocationCoordinate2D. */ NS_INLINE MGLRadianCoordinate2D MGLRadianCoordinateFromLocationCoordinate(CLLocationCoordinate2D locationCoordinate) { diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index b3060b5787..2ca4e0ed88 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -1,13 +1,12 @@ #import "MGLFoundation_Private.h" +#import "MGLGeometry_Private.h" #import "NSExpression+MGLPrivateAdditions.h" #import "MGLTypes.h" #if TARGET_OS_IPHONE #import "UIColor+MGLAdditions.h" - #define MGLEdgeInsets UIEdgeInsets #else #import "NSColor+MGLAdditions.h" - #define MGLEdgeInsets NSEdgeInsets #endif #import "NSPredicate+MGLAdditions.h" #import "NSValue+MGLStyleAttributeAdditions.h" diff --git a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm index e2cde278f4..aa3e003d04 100644 --- a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm +++ b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm @@ -1,11 +1,9 @@ #import "NSValue+MGLStyleAttributeAdditions.h" #import "MGLLight.h" #import "MGLLoggingConfiguration_Private.h" +#import "MGLGeometry_Private.h" #if TARGET_OS_IPHONE #import <UIKit/UIKit.h> - #define MGLEdgeInsets UIEdgeInsets -#else - #define MGLEdgeInsets NSEdgeInsets #endif @implementation NSValue (MGLStyleAttributeAdditions) |