Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Fix frame-delay bug affect UIViews. #483

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
24 changes: 14 additions & 10 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ - (void)setOpaque:(BOOL)opaque
}
}

- (void)updateViewsPostMapRendering {
- (void)updateViewsWithCurrentUpdateParameters {
// Update UIKit elements, prior to rendering
[self updateUserLocationAnnotationView];
[self updateAnnotationViews];
Expand All @@ -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++;
Expand All @@ -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) {
Expand Down