diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index a391a194f8c..a56260ee48c 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -4,6 +4,10 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C ## main +## (unreleased) + +- Temporary workaround for map display freeze / stutter when using annotation views with Metal backend. [Issue 2117](https://github.com/maplibre/maplibre-native/issues/2117) fixed by [PR 2148](https://github.com/maplibre/maplibre-native/pull/2148) + ## 6.2.0 - Add support for [multi sprites](https://github.com/maplibre/maplibre-native/pull/1858). More information on this feature can be found in the [Style Spec Documentation](https://maplibre.org/maplibre-style-spec/sprite/#multiple-sprite-sources). diff --git a/platform/ios/app/MBXAppDelegate.m b/platform/ios/app/MBXAppDelegate.m index 4766c7ad0a7..549eb5acd59 100644 --- a/platform/ios/app/MBXAppDelegate.m +++ b/platform/ios/app/MBXAppDelegate.m @@ -11,7 +11,7 @@ @implementation MBXAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { -#ifndef MLN_DISABLE_LOGGING +#ifndef MLN_LOGGING_DISABLED [MLNLoggingConfiguration sharedConfiguration].loggingLevel = MLNLoggingLevelFault; #endif [MLNSettings useWellKnownTileServer:MLNMapTiler]; diff --git a/platform/ios/benchmark/MBXBenchAppDelegate.mm b/platform/ios/benchmark/MBXBenchAppDelegate.mm index 99f9c8c6db5..287d9ec4943 100644 --- a/platform/ios/benchmark/MBXBenchAppDelegate.mm +++ b/platform/ios/benchmark/MBXBenchAppDelegate.mm @@ -8,7 +8,7 @@ @implementation MBXBenchAppDelegate - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { -#ifndef MLN_DISABLE_LOGGING +#ifndef MLN_LOGGING_DISABLED [MLNLoggingConfiguration sharedConfiguration].loggingLevel = MLNLoggingLevelFault; #endif diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index 930c234b387..6e4152c934d 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -6974,17 +6974,14 @@ - (void)updateAnnotationViews if (annotationView) { - CLLocationCoordinate2D coordinate = annotation.coordinate; + annotationView.center = MLNPointRounded([self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self]); + // Every so often (1 out of 1000 frames?) the mbgl query mechanism fails. This logic spot checks the // offscreenAnnotations values -- if they are actually still on screen then the view center is // moved and the enqueue operation is avoided. This allows us to keep the performance benefit of // using the mbgl query result. It also forces views that have just gone offscreen to be cleared // fully from view. - if (MLNCoordinateInCoordinateBounds(coordinate, coordinateBounds)) - { - annotationView.center = [self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self]; - } - else + if (!MLNCoordinateInCoordinateBounds(annotation.coordinate, coordinateBounds)) { if (annotationView.layer.animationKeys.count > 0) { continue; @@ -6995,7 +6992,11 @@ - (void)updateAnnotationViews adjustedCenter.x = -CGRectGetWidth(self.frame) * 10.0; annotationView.center = adjustedCenter; - [self enqueueAnnotationViewForAnnotationContext:annotationContext]; + // Disable the offscreen annotation view recycling on Metal because of issue https://github.com/maplibre/maplibre-native/issues/2117 + // TLDR: Metal view rendering stutter / freeze +#if !MLN_RENDER_BACKEND_METAL + [self enqueueAnnotationViewForAnnotationContext:annotationContext]; +#endif } } }