From ce6fd754968ebef95c6f05049054bfb27f7753a9 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Sat, 26 Sep 2020 14:41:52 -0400 Subject: [PATCH 1/2] Move call that update annotation views --- platform/ios/src/MGLMapView.mm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 8628701e74..820f56404b 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1099,7 +1099,7 @@ - (void)setOpaque:(BOOL)opaque } } -- (void)updateViewsPostMapRendering { +- (void)updateViewsWithCurrentUpdateParameters { // Update UIKit elements, prior to rendering [self updateUserLocationAnnotationView]; [self updateAnnotationViews]; @@ -1120,6 +1120,19 @@ - (BOOL)renderSync if (!self.dormant && needsRender) { + // It's important to call this *before* `_rendererFrontend->render()`, as + // that function saves the current `updateParameters` before rendering. If this + // occurs after then the views will be a frame behind. + // + // The update parameters will have been updated earlier, for example by + // calls to easeTo, flyTo, called from gesture handlers. + + MGL_SIGNPOST_BEGIN(_log, _signpost, "renderSync", "update"); + [self updateViewsWithCurrentUpdateParameters]; + MGL_SIGNPOST_END(_log, _signpost, "renderSync", "update"); + + // - - - - - + MGL_SIGNPOST_BEGIN(_log, _signpost, "renderSync", "render"); if (_rendererFrontend) { _numberOfRenderCalls++; @@ -1136,15 +1149,6 @@ - (BOOL)renderSync } } MGL_SIGNPOST_END(_log, _signpost, "renderSync", "render"); - - // - - - - - - - // TODO: This should be moved from what's essentially the UIView rendering - // To do this, add view models that can be updated separately, before the - // UIViews can be updated to match - MGL_SIGNPOST_BEGIN(_log, _signpost, "renderSync", "update"); - [self updateViewsPostMapRendering]; - MGL_SIGNPOST_END(_log, _signpost, "renderSync", "update"); } if (hasPendingBlocks) { From dbbcd43144bcb1d90826e63799cd802b167f7514 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Sat, 26 Sep 2020 14:51:29 -0400 Subject: [PATCH 2/2] Update change log --- platform/ios/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 908bbfdc6e..7db35bc948 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,10 +2,14 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. -## 6.2.1 - September 23, 2020 +## master ### 🐞 Bug fixes +* Fixed a bug with UIViews being incorrectly updated with a one frame delay. ([#483](https://github.com/mapbox/mapbox-gl-native-ios/pull/483)) + +## 6.2.1 - September 23, 2020 + * Fixed an issue where completion blocks were not called until the map was rendered. ([#463](https://github.com/mapbox/mapbox-gl-native-ios/pull/463)) * Fixed an issue that caused a crash when custom location managers did not implement `MGLLocationManager.accuracyAuthorization`. ([#474](https://github.com/mapbox/mapbox-gl-native-ios/pull/474)) * Fixed a crash that occurred when `MGLIdeographicFontFamilyName` was set to `NO`. ([#467](https://github.com/mapbox/mapbox-gl-native-ios/pull/467), [#476](https://github.com/mapbox/mapbox-gl-native-ios/pull/476))