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

Commit

Permalink
Fix frame-delay bug affect UIViews. (#483)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8689173)
  • Loading branch information
Julian Rex authored and julianrex committed Oct 16, 2020
1 parent 7526f6b commit f4765a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
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

0 comments on commit f4765a0

Please sign in to comment.