diff --git a/platform/macos/src/MLNMapView+Metal.h b/platform/macos/src/MLNMapView+Metal.h index d24778f98..b2ea4995b 100644 --- a/platform/macos/src/MLNMapView+Metal.h +++ b/platform/macos/src/MLNMapView+Metal.h @@ -39,6 +39,8 @@ public: MLNBackendResource* getObject() override; void display() override; + void drawableSizeChanged(CGSize size); + private: bool presentsWithTransaction = true; }; diff --git a/platform/macos/src/MLNMapView+Metal.mm b/platform/macos/src/MLNMapView+Metal.mm index bc4f9c42c..126cc1482 100644 --- a/platform/macos/src/MLNMapView+Metal.mm +++ b/platform/macos/src/MLNMapView+Metal.mm @@ -25,6 +25,7 @@ } - (void)mtkView:(MTKView*)view drawableSizeWillChange:(CGSize)size { + _impl->drawableSizeChanged(size); } - (void)drawInMTKView:(MTKView*)view { @@ -134,6 +135,11 @@ MLNMapViewMetalImpl::MLNMapViewMetalImpl(MLNMapView* nativeView_) resource.presentsWithTransaction = presentsWithTransaction; [mapView addSubview:resource.mtlView positioned:NSWindowBelow relativeTo:nil]; + drawableSizeChanged(resource.mtlView.drawableSize); +} + +void MLNMapViewMetalImpl::drawableSizeChanged(CGSize drawableSize) { + size = {static_cast(drawableSize.width), static_cast(drawableSize.height)}; } MLNMapViewMetalImpl::~MLNMapViewMetalImpl() = default;