summaryrefslogtreecommitdiff
path: root/platform/osx/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx/src/MGLMapView.mm')
-rw-r--r--platform/osx/src/MGLMapView.mm25
1 files changed, 15 insertions, 10 deletions
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 065a3a00c2..73cbb7fe80 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -249,7 +249,7 @@ public:
NSString *cachePath = cacheURL ? cacheURL.path : @"";
_mbglFileSource = new mbgl::DefaultFileSource(cachePath.UTF8String, [[[[NSBundle mainBundle] resourceURL] path] UTF8String]);
- _mbglMap = new mbgl::Map(*_mbglView, *_mbglFileSource, mbgl::MapMode::Continuous);
+ _mbglMap = new mbgl::Map(*_mbglView, *_mbglFileSource, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None);
// Install the OpenGL layer. Interface Builder’s synchronous drawing means
// we can’t display a map, so don’t even bother to have a map layer.
@@ -559,19 +559,24 @@ public:
}
- (void)viewDidMoveToWindow {
- if (self.dormant && self.window) {
+ NSWindow *window = self.window;
+ if (self.dormant && window) {
_mbglMap->resume();
self.dormant = NO;
}
- [self.window addObserver:self
- forKeyPath:@"contentLayoutRect"
- options:NSKeyValueObservingOptionInitial
- context:NULL];
- [self.window addObserver:self
- forKeyPath:@"titlebarAppearsTransparent"
- options:NSKeyValueObservingOptionInitial
- context:NULL];
+ if (window && _mbglMap->getConstrainMode() == mbgl::ConstrainMode::None) {
+ _mbglMap->setConstrainMode(mbgl::ConstrainMode::HeightOnly);
+ }
+
+ [window addObserver:self
+ forKeyPath:@"contentLayoutRect"
+ options:NSKeyValueObservingOptionInitial
+ context:NULL];
+ [window addObserver:self
+ forKeyPath:@"titlebarAppearsTransparent"
+ options:NSKeyValueObservingOptionInitial
+ context:NULL];
}
- (BOOL)wantsLayer {