-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add LatLngforScreenCoordinate to snapshotter API #12221
Conversation
platform/ios/CHANGELOG.md
Outdated
@@ -2,6 +2,13 @@ | |||
|
|||
Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. | |||
|
|||
## Future |
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.
We leave the word master
for this case.
platform/macos/CHANGELOG.md
Outdated
@@ -1,5 +1,11 @@ | |||
# Changelog for Mapbox Maps SDK for macOS | |||
|
|||
## Future |
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.
Same as above.
platform/ios/CHANGELOG.md
Outdated
|
||
### Other changes | ||
|
||
* Added `-[MGLSnapshot coordinateForPoint:]` that returns a map coordinate for a specified snapshot image point. ([#12221](https://github.com/mapbox/mapbox-gl-native/pull/12221)) |
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.
I think you meant -[MGLMapSnapshot coordinateForPoint:]
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.
Great catch - thanks!
platform/macos/CHANGELOG.md
Outdated
|
||
### Other changes | ||
|
||
* Added `-[MGLSnapshot coordinateForPoint:]` that returns a map coordinate for a specified snapshot image point. ([#12221](https://github.com/mapbox/mapbox-gl-native/pull/12221)) |
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.
Same as above.
@@ -85,6 +85,11 @@ MGL_EXPORT | |||
*/ | |||
- (CGPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate; | |||
|
|||
/** | |||
Converts the specified image point to a map coordinate |
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.
Nit: missing period.
|
||
- (CLLocationCoordinate2D)coordinateForPoint:(NSPoint)point | ||
{ | ||
mbgl::LatLng latLng = _latLngForFn(mbgl::ScreenCoordinate(point.x, point.y)); |
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.
Does this code account for the fact that the screen origin on macOS is at the bottom-left, by contrast with iOS where it’s at the top-left?
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.
No! Superb catch - and I think this will be an existing bug for -[MGLMapSnapshot pointForCoordinate:]
on macos.
mbgl::PremultipliedImage image, | ||
mbgl::MapSnapshotter::Attributions attributions, | ||
mbgl::MapSnapshotter::PointForFn pointForFn, | ||
mbgl::MapSnapshotter::LatLngForFn latLngForFn) { |
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.
Nit: This indentation is a bit extreme. It’s technically correct (per Xcode), but I think it would be reasponable to dedent a bit, such as by indenting both parameters to std::make_unique
by only two tabs.
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.
Looks good on the Android side 🚀
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.
👍🏼
99452ed
to
acef960
Compare
Rebased. |
acef960
to
846249a
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.
Few questions/nits:
- The submodule at
platform/ios/vendor/mapbox-events-ios
doesn’t need to be bumped. - Are updates to the
mapbox-gl-js
submodule intentional? - If we intend to merge @julianrex’s commits, they should be prefixed with
[ios]
and/or[macos]
(and perhaps squashed).
@friedbunny thanks for catching those! just pushed changes addressing comments. |
846249a
to
e333843
Compare
e333843
to
2311c7e
Compare
Closes #11365