Skip to content

Consider pixel density in coordinate<->point conversion (Android)#2390

Merged
alvelig merged 1 commit intoreact-native-maps:masterfrom
danielgindi:patch-2
Sep 9, 2018
Merged

Consider pixel density in coordinate<->point conversion (Android)#2390
alvelig merged 1 commit intoreact-native-maps:masterfrom
danielgindi:patch-2

Conversation

@danielgindi
Copy link
Contributor

Does any other open PR do the same thing?

Nope

What issue is this PR fixing?

pointForCoordinate and coordinateForPoint use raw pixel values, which is inconsistent with other functions and with iOS implementation.

How did you test this PR?

This affects Android code only, and was tested locally in a sample app.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied these changes to my local node module and was unable to build for android.

I believe this line needs read final double density = (double) [context.getResources().getDisplayMetrics().density;

Once I made this change to the local file, I was able to build. I can also confirm that the PR's code does fix the issue described for android.

Copy link

@jamiesonbates jamiesonbates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 146 needs to be declared with "final" otherwise the build fails with a scope error.

@danielgindi
Copy link
Contributor Author

Thanks, fixed!

Copy link

@jamiesonbates jamiesonbates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can validate that this PR solves the inaccuracy problem on Android, and does not affect IOS. Everything works as expected. We are using this updated coordinateForPoint in production now. (we have pinned a master version and added critical bug fixes like this).

@danielgindi
Copy link
Contributor Author

danielgindi commented Aug 20, 2018

There are no releases since April, seems like the guys are busy :-)

@rborn
Copy link
Collaborator

rborn commented Sep 9, 2018

LGTM @alvelig 🐽

@alvelig
Copy link
Contributor

alvelig commented Sep 9, 2018

LGTM

@alvelig alvelig merged commit 8124808 into react-native-maps:master Sep 9, 2018
@danielgindi danielgindi deleted the patch-2 branch September 11, 2018 19:03
pinpong pushed a commit to pinpong/react-native-maps that referenced this pull request Feb 28, 2025
Consider pixel density in coordinate<->point conversion (Android)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants