-
Notifications
You must be signed in to change notification settings - Fork 122
Snapshotter (runtime styling) delegates #235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good - my main questions are listed inline, but boil down to any potential confusion/overlap with existing handlers.
Also, do you have any tests for the new style handling in snapshotter?
Just the manual macosapp thing so far, but I can add an integration test. |
@@ -107,13 +68,20 @@ - (instancetype)initWithIdentifier:(NSString *)identifier { | |||
return (mbgl::style::CustomLayer *)super.rawLayer; | |||
} | |||
|
|||
- (MGLMapView *)mapView { | |||
if ([self.style.stylable isKindOfClass:[MGLMapView class]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As implemented in this PR, MGLOpenGLStyleLayer doesn’t support snapshotting, but it wouldn’t be too difficult to make it work if necessary.
I’ve added unit tests and snapshot tests of MGLMapSnapshotter that work on both iOS and macOS, unlike the iOS-only integration tests of MGLMapSnapshotter, which will help catch issues like #236. This test suite comes with an easy way to snapshot-test runtime styling for other purposes too. |
Added a protocol and property for MGLMapSnapshotter’s delegate, which it uses for runtime styling. Generalized MGLStyle to be usable in the absence of MGLMapView. Moved MGLOpenGLStyleLayer code around to compile.
7aa43fb
to
889a481
Compare
Copy layer visibility settings and translated labels from the main map to the snapshotted map.
889a481
to
b5797d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you - tests look great!
Added a protocol and property for MGLMapSnapshotter’s delegate, which it uses for runtime styling. Generalized MGLStyle to be usable in the absence of MGLMapView. Moved MGLOpenGLStyleLayer code around to compile.
In macosapp, the File ‣ Export Image command now matches the main map’s layer visibility settings and translated labels.
Added unit tests and snapshot tests of MGLMapSnapshotter that work on both iOS and macOS, unlike the iOS-only integration tests of MGLMapSnapshotter. This test suite comes with an easy way to snapshot-test runtime styling.
Fixes #200, fixes #236.
/cc @mapbox/maps-ios