diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-05-17 11:47:31 -0400 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-05-17 11:47:31 -0400 |
commit | 30376f3ce1d17522d9e64901b1bbc52906ee5267 (patch) | |
tree | 1f00d04a223a76a86e16ddebc77f56d2cff88b5b /platform/macos/src/MGLMapView.mm | |
parent | 7d1e52a3255d4eecdcd37e4fb600eb76fa9333f8 (diff) | |
parent | 146057adf90e85e3edc80446f02d20e5f6cab378 (diff) | |
download | qtlocation-mapboxgl-30376f3ce1d17522d9e64901b1bbc52906ee5267.tar.gz |
Merge branch 'release-boba' into masterupstream/fabian-merge-release-4.0.1-master
# Conflicts:
# mapbox-gl-js
# platform/android/CHANGELOG.md
# platform/android/MapboxGLAndroidSDK/gradle.properties
# platform/android/gradle/dependencies.gradle
# platform/darwin/src/MGLVectorTileSource.mm
# platform/darwin/src/MGLVectorTileSource_Private.h
# platform/ios/CHANGELOG.md
# src/mbgl/style/expression/compound_expression.cpp
Diffstat (limited to 'platform/macos/src/MGLMapView.mm')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 42fd24653e..bc9ac1e641 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -58,7 +58,7 @@ #import "NSURL+MGLAdditions.h" #import "NSColor+MGLAdditions.h" #import "NSImage+MGLAdditions.h" -#import "NSPredicate+MGLAdditions.h" +#import "NSPredicate+MGLPrivateAdditions.h" #import <QuartzCore/QuartzCore.h> #import <OpenGL/gl.h> @@ -2249,8 +2249,16 @@ public: // The annotation's anchor will bounce to the current click. NSRect positioningRect = [self positioningRectForCalloutForAnnotationWithTag:annotationTag]; + // Check for invalid (zero) positioning rect + if (NSEqualRects(positioningRect, NSZeroRect)) { + CLLocationCoordinate2D origin = annotation.coordinate; + positioningRect.origin = [self convertCoordinate:origin toPointToView:self]; + } + if (!moveOnscreen && NSIsEmptyRect(NSIntersectionRect(positioningRect, self.bounds))) { - positioningRect = CGRectMake(gesturePoint.x, gesturePoint.y, positioningRect.size.width, positioningRect.size.height); + if (!NSEqualPoints(gesturePoint, NSZeroPoint)) { + positioningRect = CGRectMake(gesturePoint.x, gesturePoint.y, positioningRect.size.width, positioningRect.size.height); + } } self.selectedAnnotation = annotation; @@ -2464,6 +2472,8 @@ public: if (callout) { NSRect rect = [self positioningRectForCalloutForAnnotationWithTag:_selectedAnnotationTag]; + NSAssert(!NSEqualRects(rect, NSZeroRect), @"Positioning rect should be non-zero"); + if (!NSIsEmptyRect(NSIntersectionRect(rect, self.bounds))) { // It's possible that the current callout hasn't been presented (since the original |