diff options
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/CHANGELOG.md | 8 | ||||
-rw-r--r-- | platform/macos/app/bg.lproj/Localizable.strings | 0 | ||||
-rw-r--r-- | platform/macos/bitrise.yml | 34 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/project.pbxproj | 26 | ||||
-rw-r--r-- | platform/macos/sdk/bg.lproj/Localizable.strings | 27 | ||||
-rw-r--r-- | platform/macos/sdk/pt-BR.lproj/Localizable.strings | 14 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 51 |
7 files changed, 114 insertions, 46 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 31b3540a7c..cad254e670 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog for Mapbox macOS SDK -## master +## v0.6.0 ### Networking and storage @@ -27,9 +27,15 @@ * Increased the default maximum zoom level from 20 to 22. ([#9835](https://github.com/mapbox/mapbox-gl-native/pull/9835)) * Added an `overlays` property to `MGLMapView`. ([#8617](https://github.com/mapbox/mapbox-gl-native/pull/8617)) * Added `-[MGLMapView cameraThatFitsShape:direction:edgePadding:]` to get a camera with zoom level and center coordinate computed to fit a shape. ([#10107](https://github.com/mapbox/mapbox-gl-native/pull/10107)) +<<<<<<< HEAD +======= +* Added support selection of shape and polyline annotations.([#9984](https://github.com/mapbox/mapbox-gl-native/pull/9984)) +* Fixed an issue where a shape annotation callout was not displayed if the centroid was not visible. ([#10255](https://github.com/mapbox/mapbox-gl-native/pull/10255)) +>>>>>>> release-agua ### Other changes +* Added a Bulgarian localization. ([#10309](https://github.com/mapbox/mapbox-gl-native/pull/10309)) * Fixed an issue that could cause line label rendering glitches when the line geometry is projected to a point behind the plane of the camera. ([#9865](https://github.com/mapbox/mapbox-gl-native/pull/9865)) * Fixed an issue that could cause a crash when using `-[MGLMapView flyToCamera:completionHandler:]` and related methods with zoom levels at or near the maximum value. ([#9381](https://github.com/mapbox/mapbox-gl-native/pull/9381)) diff --git a/platform/macos/app/bg.lproj/Localizable.strings b/platform/macos/app/bg.lproj/Localizable.strings new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/platform/macos/app/bg.lproj/Localizable.strings diff --git a/platform/macos/bitrise.yml b/platform/macos/bitrise.yml index 1f2495dab2..057193967e 100644 --- a/platform/macos/bitrise.yml +++ b/platform/macos/bitrise.yml @@ -12,39 +12,9 @@ workflows: primary: steps: - script: - title: Build - inputs: - - content: |- - #!/bin/bash - set -eu -o pipefail - brew install cmake - gem install xcpretty --no-rdoc --no-ri - export BUILDTYPE=Debug - export XCPRETTY="| tee ${BITRISE_DEPLOY_DIR}/raw-xcodebuild-output.txt | xcpretty --color --report html --output ${BITRISE_DEPLOY_DIR}/xcode-test-results.html" - make run-test - - deploy-to-bitrise-io: - title: Deploy to Bitrise.io - inputs: - - deploy_path: "test/fixtures" - - notify_user_groups: none - - is_compress: 'true' - - slack: - title: Post to Slack + title: Skip Workflow inputs: - - webhook_url: "$SLACK_HOOK_URL" - - channel: "#gl-bots" - - from_username: 'Bitrise macOS' - - from_username_on_error: 'Bitrise macOS' - - message: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> - for <https://github.com/mapbox/mapbox-gl-native/compare/${BITRISE_GIT_BRANCH}|mapbox/mapbox-gl-native@${BITRISE_GIT_BRANCH}> - by ${GIT_CLONE_COMMIT_COMMITER_NAME} - passed' - - message_on_error: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> - for <https://github.com/mapbox/mapbox-gl-native/compare/${BITRISE_GIT_BRANCH}|mapbox/mapbox-gl-native@${BITRISE_GIT_BRANCH}> - by ${GIT_CLONE_COMMIT_COMMITER_NAME} - failed' - - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png - - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png + - content: echo "This workflow is obsolete — see CircleCi." nightly-release: steps: - script: diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 34f8860686..c839bfadd3 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -385,6 +385,12 @@ DA2207BB1DC076940002F84D /* MGLStyleValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLStyleValueTests.swift; sourceTree = "<group>"; }; DA2784FD1DF03060001D5B8D /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = ../../darwin/test/Media.xcassets; sourceTree = "<group>"; }; DA2987591E1A4290002299F5 /* MGLDocumentationExampleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLDocumentationExampleTests.swift; path = ../../darwin/test/MGLDocumentationExampleTests.swift; sourceTree = "<group>"; }; + DA3389601FA3EAC4001EA329 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Foundation.strings"; sourceTree = "<group>"; }; + DA3389611FA3EDCE001EA329 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Localizable.strings; sourceTree = "<group>"; }; + DA3389621FA3EDEF001EA329 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Foundation.strings; sourceTree = "<group>"; }; + DA3389631FA3EDF5001EA329 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = bg; path = bg.lproj/Foundation.stringsdict; sourceTree = "<group>"; }; + DA3389641FA3EE00001EA329 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Localizable.strings; sourceTree = "<group>"; }; + DA33896C1FA3EF51001EA329 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = hu; path = hu.lproj/Foundation.stringsdict; sourceTree = "<group>"; }; DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCoordinateFormatter.h; sourceTree = "<group>"; }; DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLCoordinateFormatter.m; sourceTree = "<group>"; }; DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatterTests.m; path = ../../darwin/test/MGLCoordinateFormatterTests.m; sourceTree = "<group>"; }; @@ -664,6 +670,8 @@ 352742791D4C235C00A1ECE6 /* Categories */ = { isa = PBXGroup; children = ( + 1FCDF1401F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h */, + 1FCDF1411F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m */, DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */, DA8F25A71D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm */, ); @@ -727,6 +735,14 @@ name = "Test Helpers"; sourceTree = "<group>"; }; + DA33895E1FA3E997001EA329 /* Recovered References */ = { + isa = PBXGroup; + children = ( + 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */, + ); + name = "Recovered References"; + sourceTree = "<group>"; + }; DA839E891CC2E3400062CAFB = { isa = PBXGroup; children = ( @@ -736,6 +752,7 @@ DAE6C31E1CC308BC00DB3429 /* Frameworks */, DAE6C3C41CC31F7800DB3429 /* Configuration */, DA839E931CC2E3400062CAFB /* Products */, + DA33895E1FA3E997001EA329 /* Recovered References */, ); sourceTree = "<group>"; }; @@ -944,8 +961,6 @@ DAD1657F1CF4CF50001FF4B9 /* Categories */ = { isa = PBXGroup; children = ( - 1FCDF1401F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h */, - 1FCDF1411F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m */, 408AA8601DAEED3300022900 /* MGLPolygon+MGLAdditions.h */, 408AA85C1DAEED3300022900 /* MGLPolygon+MGLAdditions.m */, 408AA8611DAEED3300022900 /* MGLPolyline+MGLAdditions.h */, @@ -1345,6 +1360,7 @@ fi, nl, hu, + bg, ); mainGroup = DA839E891CC2E3400062CAFB; productRefGroup = DA839E931CC2E3400062CAFB /* Products */; @@ -1573,6 +1589,7 @@ DA618B271E68926E00CB7F44 /* fi */, DAE8CCAB1E6E8B72009B5CB0 /* nl */, DA704CBE1F637531004B3F28 /* hu */, + DA3389611FA3EDCE001EA329 /* bg */, ); name = Localizable.strings; sourceTree = "<group>"; @@ -1622,6 +1639,7 @@ DA618B2A1E6892B500CB7F44 /* fi */, DAE8CCAC1E6E8B8D009B5CB0 /* nl */, DA704CBF1F637548004B3F28 /* hu */, + DA3389641FA3EE00001EA329 /* bg */, ); name = Localizable.strings; sourceTree = "<group>"; @@ -1642,6 +1660,8 @@ DACCD9C71F1F443B00BB09A1 /* fr */, DA704CBA1F6372E8004B3F28 /* ru */, DA704CC61F666385004B3F28 /* uk */, + DA3389601FA3EAC4001EA329 /* pt-BR */, + DA3389621FA3EDEF001EA329 /* bg */, ); name = Foundation.strings; sourceTree = "<group>"; @@ -1661,6 +1681,8 @@ DA618B151E6886DF00CB7F44 /* ca */, DA618B241E6891F300CB7F44 /* lt */, DACFE7971F66EA0C00630DA8 /* vi */, + DA3389631FA3EDF5001EA329 /* bg */, + DA33896C1FA3EF51001EA329 /* hu */, ); name = Foundation.stringsdict; sourceTree = "<group>"; diff --git a/platform/macos/sdk/bg.lproj/Localizable.strings b/platform/macos/sdk/bg.lproj/Localizable.strings new file mode 100644 index 0000000000..5c71390076 --- /dev/null +++ b/platform/macos/sdk/bg.lproj/Localizable.strings @@ -0,0 +1,27 @@ +/* User-friendly error description */ +"LOAD_MAP_FAILED_DESC" = "Картата не се зареди поради неизвестна грешка."; + +/* User-friendly error description */ +"LOAD_STYLE_FAILED_DESC" = "Картата не се зареди, поради незареждане на стила."; + +/* Accessibility title */ +"MAP_A11Y_TITLE" = "Mapbox"; + +/* User-friendly error description */ +"PARSE_STYLE_FAILED_DESC" = "Картата не се зареди поради повреден стил."; + +/* User-friendly error description */ +"STYLE_NOT_FOUND_DESC" = "Картата не се зареди поради неоткрит или несъвместим стил."; + +/* Label of Zoom In button */ +"ZOOM_IN_LABEL" = "+"; + +/* Tooltip of Zoom In button */ +"ZOOM_IN_TOOLTIP" = "Приближи"; + +/* Label of Zoom Out button; U+2212 MINUS SIGN */ +"ZOOM_OUT_LABEL" = "−"; + +/* Tooltip of Zoom Out button */ +"ZOOM_OUT_TOOLTIP" = "Отдалечи"; + diff --git a/platform/macos/sdk/pt-BR.lproj/Localizable.strings b/platform/macos/sdk/pt-BR.lproj/Localizable.strings index c7490ec8d8..72fa43b657 100644 --- a/platform/macos/sdk/pt-BR.lproj/Localizable.strings +++ b/platform/macos/sdk/pt-BR.lproj/Localizable.strings @@ -1,6 +1,18 @@ -/* Accessibility title */ +/* User-friendly error description */ +"LOAD_MAP_FAILED_DESC" = "Falha ao carregar mapa devido a um erro desconhecido."; + +/* User-friendly error description */ +"LOAD_STYLE_FAILED_DESC" = "Falha ao carregar mapa porque o estilo não pode ser carregado."; + +/* Accessibility title */ "MAP_A11Y_TITLE" = "Mapbox"; +/* User-friendly error description */ +"PARSE_STYLE_FAILED_DESC" = "Falha ao carregar mapa porque o estilo está corrompido."; + +/* User-friendly error description */ +"STYLE_NOT_FOUND_DESC" = "Falha ao carregar mapa porque o estilo não pode ser encontrado ou é incompatível."; + /* Label of Zoom In button */ "ZOOM_IN_LABEL" = "+"; diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 0aa5bdc9db..8df6f4545d 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -1488,7 +1488,7 @@ public: if (hitAnnotationTag != _selectedAnnotationTag) { id <MGLAnnotation> annotation = [self annotationWithTag:hitAnnotationTag]; NSAssert(annotation, @"Cannot select nonexistent annotation with tag %u", hitAnnotationTag); - [self selectAnnotation:annotation]; + [self selectAnnotation:annotation atPoint:gesturePoint]; } } else { [self deselectAnnotation:self.selectedAnnotation]; @@ -1791,6 +1791,12 @@ public: } std::vector<MGLAnnotationTag> annotationTags = [self annotationTagsInRect:rect]; + std::vector<MGLAnnotationTag> shapeAnnotationTags = [self shapeAnnotationTagsInRect:rect]; + + if (shapeAnnotationTags.size()) { + annotationTags.insert(annotationTags.end(), shapeAnnotationTags.begin(), shapeAnnotationTags.end()); + } + if (annotationTags.size()) { NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:annotationTags.size()]; @@ -2050,13 +2056,18 @@ public: queryRect = NSInsetRect(queryRect, -MGLAnnotationImagePaddingForHitTest, -MGLAnnotationImagePaddingForHitTest); std::vector<MGLAnnotationTag> nearbyAnnotations = [self annotationTagsInRect:queryRect]; + std::vector<MGLAnnotationTag> nearbyShapeAnnotations = [self shapeAnnotationTagsInRect:queryRect]; + + if (nearbyShapeAnnotations.size()) { + nearbyAnnotations.insert(nearbyAnnotations.end(), nearbyShapeAnnotations.begin(), nearbyShapeAnnotations.end()); + } if (nearbyAnnotations.size()) { // Assume that the user is fat-fingering an annotation. NSRect hitRect = NSInsetRect({ point, NSZeroSize }, -MGLAnnotationImagePaddingForHitTest, -MGLAnnotationImagePaddingForHitTest); - + // Filter out any annotation whose image is unselectable or for which // hit testing fails. auto end = std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) { @@ -2065,12 +2076,17 @@ public: if (!annotation) { return true; } - + + if ([annotation isKindOfClass:[MGLShape class]]) + { + return false; + } + MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag]; if (!annotationImage.selectable) { return true; } - + // Filter out the annotation if the fattened finger didn’t land on a // translucent or opaque pixel in the image. NSRect annotationRect = [self frameOfImage:annotationImage.image @@ -2149,6 +2165,14 @@ public: }); } +- (std::vector<MGLAnnotationTag>)shapeAnnotationTagsInRect:(NSRect)rect { + // Cocoa origin is at the lower-left corner. + return _rendererFrontend->getRenderer()->queryShapeAnnotations({ + { NSMinX(rect), NSHeight(self.bounds) - NSMaxY(rect) }, + { NSMaxX(rect), NSHeight(self.bounds) - NSMinY(rect) }, + }); +} + - (id <MGLAnnotation>)selectedAnnotation { if ( ! _annotationContextsByAnnotationTag.count(_selectedAnnotationTag) || _selectedAnnotationTag == MGLAnnotationTagNotFound) { @@ -2192,11 +2216,11 @@ public: - (void)selectAnnotation:(id <MGLAnnotation>)annotation { - // Only point annotations can be selected. - if (!annotation || [annotation isKindOfClass:[MGLMultiPoint class]]) { - return; - } + [self selectAnnotation:annotation atPoint:NSZeroPoint]; +} +- (void)selectAnnotation:(id <MGLAnnotation>)annotation atPoint:(NSPoint)gesturePoint +{ id <MGLAnnotation> selectedAnnotation = self.selectedAnnotation; if (annotation == selectedAnnotation) { return; @@ -2211,10 +2235,10 @@ public: [self addAnnotation:annotation]; } - // The annotation can’t be selected if no part of it is hittable. + // The annotation's anchor will bounce to the current click. NSRect positioningRect = [self positioningRectForCalloutForAnnotationWithTag:annotationTag]; if (NSIsEmptyRect(NSIntersectionRect(positioningRect, self.bounds))) { - return; + positioningRect = CGRectMake(gesturePoint.x, gesturePoint.y, positioningRect.size.width, positioningRect.size.height); } self.selectedAnnotation = annotation; @@ -2314,6 +2338,13 @@ public: if (!annotation) { return NSZeroRect; } + if ([annotation isKindOfClass:[MGLMultiPoint class]]) { + CLLocationCoordinate2D origin = annotation.coordinate; + CGPoint originPoint = [self convertCoordinate:origin toPointToView:self]; + return CGRectMake(originPoint.x, originPoint.y, MGLAnnotationImagePaddingForHitTest, MGLAnnotationImagePaddingForHitTest); + + } + NSImage *image = [self imageOfAnnotationWithTag:annotationTag].image; if (!image) { image = [self dequeueReusableAnnotationImageWithIdentifier:MGLDefaultStyleMarkerSymbolName].image; |