diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-11-20 16:04:35 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-01-05 10:01:31 -0800 |
commit | 5f58c015e4fe5cb93d04f959ffd1dc65ea760375 (patch) | |
tree | 287828a30f19cba9f3704292bc9e81418f34b1c7 /platform | |
parent | f8f735b5745051e94cf4f527a5b33b09825bc86d (diff) | |
download | qtlocation-mapboxgl-5f58c015e4fe5cb93d04f959ffd1dc65ea760375.tar.gz |
[iOS] Transparent GLKView
Tie layer opacity to view opacity.
Fixes #3038.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 5eee1d52ff..0f969e494c 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -157,6 +157,8 @@ public: MBGLView *_mbglView; std::shared_ptr<mbgl::SQLiteCache> _mbglFileCache; mbgl::DefaultFileSource *_mbglFileSource; + + BOOL _opaque; NS_MUTABLE_ARRAY_OF(NSURL *) *_bundledStyleURLs; @@ -257,6 +259,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration) - (void)commonInit { _isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent; + _opaque = YES; BOOL background = [UIApplication sharedApplication].applicationState == UIApplicationStateBackground; if (!background) @@ -450,6 +453,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration) _glView.drawableStencilFormat = GLKViewDrawableStencilFormat8; _glView.drawableDepthFormat = GLKViewDrawableDepthFormat16; _glView.contentScaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [[UIScreen mainScreen] nativeScale] : [[UIScreen mainScreen] scale]; + _glView.layer.opaque = _opaque; _glView.delegate = self; [_glView bindDrawable]; [self insertSubview:_glView atIndex:0]; @@ -714,6 +718,16 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration) [super updateConstraints]; } +- (BOOL)isOpaque +{ + return _opaque; +} + +- (void)setOpaque:(BOOL)opaque +{ + _glView.layer.opaque = _opaque = opaque; +} + // This is the delegate of the GLKView object's display call. - (void)glkView:(__unused GLKView *)view drawInRect:(__unused CGRect)rect { |