summaryrefslogtreecommitdiff
path: root/platform/default/mbgl/map/map_snapshotter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/default/mbgl/map/map_snapshotter.cpp')
-rw-r--r--platform/default/mbgl/map/map_snapshotter.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/platform/default/mbgl/map/map_snapshotter.cpp b/platform/default/mbgl/map/map_snapshotter.cpp
index 149ef22e7a..565f72930d 100644
--- a/platform/default/mbgl/map/map_snapshotter.cpp
+++ b/platform/default/mbgl/map/map_snapshotter.cpp
@@ -87,6 +87,15 @@ void MapSnapshotter::Impl::snapshot(ActorRef<MapSnapshotter::Callback> callback)
return transform.latLngToScreenCoordinate(unwrappedLatLng);
}};
+ // Create lambda that captures the current transform state
+ // and can be used to translate for geographic to screen
+ // coordinates
+ assert (frontend.getTransformState());
+ LatLngForFn latLngForFn { [=, transformState = *frontend.getTransformState()] (const ScreenCoordinate& screenCoordinate) {
+ Transform transform { transformState };
+ return transform.screenCoordinateToLatLng(screenCoordinate);
+ }};
+
// Collect all source attributions
std::vector<std::string> attributions;
for (auto source : map.getStyle().getSources()) {
@@ -102,7 +111,8 @@ void MapSnapshotter::Impl::snapshot(ActorRef<MapSnapshotter::Callback> callback)
error,
error ? PremultipliedImage() : frontend.readStillImage(),
std::move(attributions),
- std::move(pointForFn)
+ std::move(pointForFn),
+ std::move(latLngForFn)
);
});
}