[google_maps_flutter] Add Projection methods to google_maps#2108
[google_maps_flutter] Add Projection methods to google_maps#2108iskakaushik merged 3 commits intoflutter:masterfrom iskakaushik:issue-37959
Conversation
This doesn't yet expose the full projection functionality but addresses the most common usecases to translate screen coordinates to latlngs. Issue: flutter/flutter#37959
| } | ||
| case "map#getScreenCoordinate": | ||
| { | ||
| if (googleMap != null) { |
There was a problem hiding this comment.
subjective, optional: Consider using early returns/guard clauses here instead to reduce nesting.
https://testing.googleblog.com/2017/06/code-health-reduce-nesting-reduce.html
You're doing this in multiple places, so it may even be worth extracting this out into a helper method that takes result and calls error for you and returns false if map isn't initialized. That way your checks could just be one liners guarding each method. This is just a totally optional style subjection though.
if (!assertGoogleMapInitialized(/*methodName=*/"getVisibleRegion", result)) {
return;
}There was a problem hiding this comment.
Interesting approach. I like the idea. I will revisit this in a follow-up PR.
| /// Return [ScreenCoordinate] of the [LatLng] in the current map view. | ||
| /// | ||
| /// A projection is used to translate between on screen location and geographic coordinates. | ||
| /// Screen location is in screen pixels (not display pixels) with respect to the top left corner |
There was a problem hiding this comment.
I think this would be useful information on ScreenInformation's DartDoc, too. I think it would be helpful to also say on the x and y members how the coordinate system works, eg is 0,0 top left or center?
…2108) [google_maps_flutter] Add Projection methods to google_maps This doesn't yet expose the full projection functionality but addresses the most common use-cases to translate screen coordinates to latlngs. Issue: flutter/flutter#37959
…2108) [google_maps_flutter] Add Projection methods to google_maps This doesn't yet expose the full projection functionality but addresses the most common use-cases to translate screen coordinates to latlngs. Issue: flutter/flutter#37959
This doesn't yet expose the full projection functionality but
addresses the most common usecases to translate screen coordinates
to latlngs.
Issue: flutter/flutter#37959