diff options
author | Jesse Bounds <jesse@rebounds.net> | 2017-10-24 17:40:47 -0700 |
---|---|---|
committer | Jesse Bounds <jesse@rebounds.net> | 2017-10-25 12:44:41 -0700 |
commit | aad26419b4b196cec35d5b349ae3977782e8fa6d (patch) | |
tree | 854a87506f6a8d2d4feffa2f385a6e5aa641bed2 | |
parent | 01ed21a3c40d8f1e7b95404fd03162b34dce894d (diff) | |
download | qtlocation-mapboxgl-aad26419b4b196cec35d5b349ae3977782e8fa6d.tar.gz |
[ios] Move scale bar content size invalidation to map view
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 8 | ||||
-rw-r--r-- | platform/ios/src/MGLScaleBar.mm | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 0e76c0c71c..2bb46a3638 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]; diff --git a/platform/ios/src/MGLScaleBar.mm b/platform/ios/src/MGLScaleBar.mm index 410aa7d57e..966555e46a 100644 --- a/platform/ios/src/MGLScaleBar.mm +++ b/platform/ios/src/MGLScaleBar.mm @@ -225,9 +225,6 @@ static const CGFloat MGLFeetPerMeter = 3.28084; CGRectGetMinY(self.frame), size.width, size.height); - - [self invalidateIntrinsicContentSize]; - [self setNeedsLayout]; } - (void)updateVisibility { |