summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index d0d34dbfa9..740555840f 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1015,6 +1015,14 @@ public:
// This gets called when the view dimension changes, e.g. because the device is being rotated.
- (void)layoutSubviews
{
+ // Calling this here instead of in the scale bar itself because if this is done in the
+ // scale bar instance, it triggers a call to this this `layoutSubviews` method that
+ // calls `_mbglMap->setSize()` just below that triggers rendering update which triggers
+ // another scale bar update which causes a rendering update loop and a major performace
+ // degradation. The only time the scale bar's intrinsic content size _must_ invalidated
+ // is here as a reaction to this object's view dimension changes.
+ [self.scaleBar invalidateIntrinsicContentSize];
+
[super layoutSubviews];
[self adjustContentInset];