Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added MapController.pointToLatLng() to get LatLng of given screen point #1115

Merged
merged 7 commits into from
May 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix zoom breaking pointToLatLng()
  • Loading branch information
HugoHeneault committed May 18, 2022
commit d2ddde2397127fa1e674b987c1ca7f244d2c7ea0
8 changes: 6 additions & 2 deletions lib/src/map/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ class MapControllerImpl implements MapController {

@override
LatLng? pointToLatLng(CustomPoint localPoint) {
final width = _state.size.x;
final height = _state.size.y;
if (_state.originalSize == null) {
return null;
}

final width = _state.originalSize!.x;
final height = _state.originalSize!.y;

var localPointCenterDistance =
CustomPoint((width / 2) - localPoint.x, (height / 2) - localPoint.y);
Expand Down