diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index 3f7eb8e70b7..09fe6099f44 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -6976,14 +6976,18 @@ - (void)updateAnnotationViews if (annotationView) { - annotationView.center = MLNPointRounded([self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self]); + CLLocationCoordinate2D coordinate = annotation.coordinate; // 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(annotation.coordinate, coordinateBounds)) + if (MLNCoordinateInCoordinateBounds(coordinate, coordinateBounds)) + { + annotationView.center = [self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self]; + } + else { if (annotationView.layer.animationKeys.count > 0) { continue; @@ -6993,12 +6997,8 @@ - (void)updateAnnotationViews CGPoint adjustedCenter = annotationView.center; adjustedCenter.x = -CGRectGetWidth(self.frame) * 10.0; annotationView.center = adjustedCenter; - - // 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 + + [self enqueueAnnotationViewForAnnotationContext:annotationContext]; } } }