[iOS] Transparent GLKView
Tie layer opacity to view opacity. Fixes #3038.
This commit is contained in:
@@ -46,6 +46,7 @@ Known issues:
|
||||
- The user dot’s callout view is now centered above the user dot. It was previously offset slightly to the left. ([#3261](https://github.com/mapbox/mapbox-gl-native/pull/3261))
|
||||
- Fixed an issue with small map views not properly fitting annotations within bounds. (#[3407](https://github.com/mapbox/mapbox-gl-native/pull/3407))
|
||||
- The map will now snap to north. ([#3403](https://github.com/mapbox/mapbox-gl-native/pull/3403))
|
||||
- The map view’s background can now be transparent or translucent, as long as the style’s background layer is transparent or translucent and `MGLMapView.opaque` is set to `NO`. ([#3096](https://github.com/mapbox/mapbox-gl-native/pull/3096))
|
||||
|
||||
## iOS 3.0.1
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user